软件开发师 [英] Software Developer

查看:87
本文介绍了软件开发师的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我是.Net Framework的初学者

hello , i am a beginnerx in .Net Framework

推荐答案

这可能会对你有所帮助,因为如果你不了解基础知识就会很难了解你可以做什么或者你在做什么,在哪里,什么和为什么做什么。

This may help you, becuase if you don't understand the basics makes it hard to see what you can do or what you are doing on the when, where, what and why.

你学习了一半,你将领先于游戏。 :)

You learn half of it and you'll be ahead of the game. :)

在Visual Stuido 2017社区获取免费版本,下载并安装。

Get the free version on Visual Stuido 2017 Community, download it and install it.

https://medium.com/@hamzzza .ahmed95 /四支柱 - 面向对象 - 编程 - oop-e8d7822aa219

https://medium.com/@hamzzza.ahmed95/four-pillars-of-object-oriented-programming-oop-e8d7822aa219

https://stackify.com/oop-concepts-c-sharp/

https://stackify.com/oop-concepts-c-sharp/

OO在Java和.NET中是OO,OO的原则是相同的

OO is OO in Java and .NET the principles of OO are the same

https://alfredjava.wordpress.com/2008/07/08/class- vs-object-vs-instance /

https://alfredjava.wordpress.com/2008/07/08/class-vs-object-vs-instance/

下面链接中的SoC

https://en.wikipedia.org/wiki/Separation_of_concerns

https://en.wikipedia.org/wiki/Separation_of_concerns

http://www.dotnet-stuff.com/tutorials/c-sharp/understanding-loose-coupling-and-tight-coupling

http://www.dotnet-stuff.com/tutorials/c-sharp/understanding-loose-coupling-and-tight-coupling

https: //www.tutorialspoint.com/csharp/csharp_interfaces.htm

https://www.tutorialspoint.com/csharp/csharp_interfaces.htm

https://www.c-sharpcorner.com/blogs/understanding-interfaces-via-loose-coupling-and-紧耦合

https://www.c-sharpcorner.com/blogs/understanding-interfaces-via-loose-coupling-and-tight-coupling

https://csharp-station.com/Tutorial/CSharp/Lesson13

https://csharp-station.com/Tutorial/CSharp/Lesson13

https://www.dotnetodyssey.com/ 2017/05/31 / difference-fields-properties-c /

https://www.dotnetodyssey.com/2017/05/31/difference-fields-properties-c/

以下链接中的SoD ...

SoD in link below...

http s://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC-MVP

https://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC-MVP

分层或n层你会更多此时对分层感兴趣,但风格非常相似。

Layered or n-tier you'll be more interested in layered at this time, but the styles are very similar.

https://docs.microsoft.com/en-us/previous-versions/msp-np/ee658117(v = pandp.10)

https://docs.microsoft.com/en-us/previous-versions/msp-n-p/ee658117(v=pandp.10)

https://www.codeproject.com/Articles/36847/Three-Layer-Architecture-in-C-NET

https://www.codeproject.com/Articles/36847/Three-Layer-Architecture-in-C-NET

也许有一天你会学习如何使用DTO或DTO(s)的集合而不是tableadapters,数据集和数据表。但是现在,你应该 了解n层,但将其应用于分层样式。

Maybe one day you'll learn how to use the DTO or a collection of DTO(s) instead of tableadapters, datasets and datatables. However for now, you should  understand n-tier but apply it to layered style.

https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp

https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp

观看节目,因为它会教你MVP和使用它。一个节目涵盖Windows窗体,您还将看到界面的实际应用以及它们如何促进松散耦合。

Watch the shows, becuase it will teach you about MVP and using it. One show covers Windows forms, and you'll also see Interfaces in action and how they promote loose coupling.

http://polymorphicpodcast.com/shows/mv-patterns/

http://polymorphicpodcast.com/shows/mv-patterns/

您可以在数据访问层(DAL)中使用DAO,该DAO显示每个DAO类的接口使用情况。

You can use DAO in the Data Access Layer (DAL) that shows Interface usage per a DAO class.

https://en.wikipedia.org/ wiki / Data_access_object

https://en.wikipedia.org/wiki/Data_access_object

https://www.tutorialspoint.com/design_pattern/data_access_object_pattern.htm

https://www.tutorialspoint.com/design_pattern/data_access_object_pattern.htm

DAO和DTO模式 在DAL和EF中行动。

DAO and DTO pattern  in action at the DAL and EF.

此链接只显示EF。 

The link is just showing you EF. 

https://www.c-sharpcorner。 com / article / crud-operation-using-entity-framework-in-windows-form-application /

https://www.c-sharpcorner.com/article/crud-operation-using-entity-framework-in-windows-form-application/

using System;
using System.Collections.Generic;
using Entities;

namespace DAL.DAO
{
    public interface IDAOStudent
    {
        DTOStudent GetStudentById(Int32 id);
        List<DTOStudent> GetStudents();
        void CreateStudent(DTOStudent dto);
        void UpdateStudent(DTOStudent dto);
        void DeleteStudent(Int32 id);
    }
}
================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Entity;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;
using Entities;
using DAL.Model;

namespace DAL.DAO
{
    public class DAOStudent : IDAOStudent
    {
        public DTOStudent GetStudentById(Int32 id)
        {
            var dto = new DTOStudent();
            using (var context = new CUDataEntities())
            {
                var student = (context.Students.Where(a => a.StudentID == id)).SingleOrDefault();

                if (student != null)
                {
                    dto.StudentID = student.StudentID;
                    dto.FirstName = student.FirstName;
                    dto.LastName = student.LastName;
                    dto.EnrollmentDate = student.EnrollmentDate;

                    var enrolllments =  new DAOEnrollment().GetEntrollmentsByStudentId(id).ToList();
                    var courses = new DAOCourse().GetCoursesByStudentCourseId(student.StudentID).ToList();

                    dto.EnrollsandCourses = (from a in enrolllments
                                  join b in courses on a.CourseID equals b.CourseID
                    select new  DTOEnrollandCourse()
                     { Title = b.Title, Credits = b.Credits, Grade = a.Grade }).ToList();
                }
            }

            return dto;
        }
        public void CreateStudent(DTOStudent dto)
        {
            using (var context = new CUDataEntities())
            {
                var student = new Student
                {
                    FirstName = dto.FirstName,
                    LastName = dto.LastName,
                    EnrollmentDate = dto.EnrollmentDate
                };

                context.Students.Add(student);
                context.SaveChanges();
            }
        }

        public void DeleteStudent(int id)
        {
            Student student;
            using (var context = new CUDataEntities())
            {
                student = (context.Students.Where(a => a.StudentID == id)).SingleOrDefault();
            }

            using (var newContext = new CUDataEntities())
            {
                newContext.Entry(student).State = System.Data.Entity.EntityState.Deleted;
                newContext.SaveChanges();
            }
        }

        public List<DTOStudent> GetStudents()
        {
           
            var dtos = new List<DTOStudent>();

            using (var context = new CUDataEntities())
            {
      
                var students = context.Students.ToList();

                foreach(var stud in students)
                {
                    var dto = new DTOStudent
                    {
                        StudentID = stud.StudentID,
                        FirstName = stud.FirstName,
                        LastName = stud.LastName,
                        EnrollmentDate = stud.EnrollmentDate
                    };

                    dtos.Add(dto);
                }
            }

            return dtos;
        }

        public void UpdateStudent(DTOStudent dto)
        {
            var student = new Student();

            using (var context = new CUDataEntities())
            {
                student = (context.Students.Where(a => a.StudentID == dto.StudentID)).SingleOrDefault();
            }

            if (student != null)
            {
                student.FirstName = dto.FirstName;
                student.LastName = dto.LastName;
                student.EnrollmentDate = dto.EnrollmentDate;
            } 

            using (var dbcontext = new CUDataEntities())
            {
                if (student != null)
                {
                    dbcontext.Entry(student).State = EntityState.Modified;
                    dbcontext.SaveChanges();
                }
            }
        }
    }
}





using System;
using System.Collections.Generic;


namespace Entities
{
    public class DTOStudent
    {
        public Int32 StudentID { get; set; }

        public string LastName { get; set; }

        public string FirstName { get; set; }

        public DateTime? EnrollmentDate { get; set; }

        public virtual ICollection<DTOEnrollandCourse> EnrollsandCourses { get; set; }
      
    }
}


这篇关于软件开发师的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆