コード例 #1
0
        static void Main()
        {
            var connectionString = @"Server=(local)\SQLEXPRESS;Database=MiniORM;Integrated Security=true";
            var context          = new SoftUniDbContextClass(connectionString);

            context.Employees.Add(new Employee {
                FirstName = "Ivan", LastName = "Asen", IsEmployed = true, DepartmentId = 2
            });

            context.Employees.Last().MiddleName = "Krumov";
            context.Employees.Remove(context.Employees.Skip(4).First());
            context.SaveChanges();
        }
        public static void Main()
        {
            var connectionString = @"Server=WARGLAIVE\SQLEXPRESS;Database=MiniORM;Integrated Security=True";
            var context          = new SoftUniDbContextClass(connectionString);

            context.Employees.Add(new Employee
            {
                FirstName    = "Gosho",
                LastName     = "Inserted",
                DepartmentId = context.Departments.First().Id,
                IsEmployed   = true
            });
            var employee = context.Employees.Last();

            employee.FirstName = "Modified";
            context.SaveChanges();
        }
コード例 #3
0
ファイル: StartUp.cs プロジェクト: DaniGwen/EF-Mini-ORM
        static void Main()
        {
            var context = new SoftUniDbContextClass(connection);

            context.Employee.Add(new Data.Entities.Employee
            {
                FirstName    = "John",
                LastName     = "Snow",
                DepartmentId = context.Department.First().Id,
                IsEmployed   = true
            });

            var employee = context.Employee.Last();

            employee.FirstName = "Ben";

            context.SaveChanges();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            string connectionString       = @"Server = .; Database = MiniORM; Integrated security = true;";
            SoftUniDbContextClass context = new SoftUniDbContextClass(connectionString);

            context.Employees.Add(new Employee
            {
                FirstName    = "Gary",
                LastName     = "Preston",
                DepartmentId = context.Departments.First().Id,
                IsEmployed   = true,
            });
            Employee employee = context.Employees.Last();

            employee.FirstName = "Modified";

            context.SaveChanges();
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            string connectionString = @"Server=DESKTOP-L5A0R6C\SQLEXPRESS;Database=MiniORM;Integrated Security=True";

            var context = new SoftUniDbContextClass(connectionString);

            context.Employees.Add(new Employee
            {
                FirstName    = "Gosho",
                LastName     = "Inserted",
                IsEmployed   = true,
                DepartmentId = context.Departments.First().Id,
            });

            Employee employee = context.Employees.Last();

            employee.FirstName = "Modified";

            context.SaveChanges();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            var connectionString = "Server=(localdb)\\MSSQLLocalDB;Database=MiniORM;Integrated Security=True";

            var context = new SoftUniDbContextClass(connectionString);


            context.Employees.Add(new Employee
            {
                FirstName    = "Gosho",
                LastName     = "Inserted",
                DepartmentId = context.Departments.First().Id,
                IsEmployed   = true
            });

            var employee = context.Employees.Last();

            employee.FirstName = "Krasi";

            context.SaveChanges();
        }
コード例 #7
0
        static void Main(string[] args)
        {
            var connectionString = "Server = VALIO\\SQLEXPRESS;" +
                                   "Database = MiniORM;" +
                                   "Integrated Security = true";

            var context = new SoftUniDbContextClass(connectionString);

            context.Employees.Add(new Data.Entities.Employee
            {
                FirstName    = "Gosho",
                LastName     = "Inserted",
                DepartmentId = context.Departments.First().Id,
                IsEmployed   = true
            });

            var employee = context.Employees.Last();

            employee.FirstName = "Modified";
            context.SaveChanges();
        }
コード例 #8
0
        static void Main(string[] args)
        {
            string connectionParams = "Server=.; Database=MiniORM; Integrated Security=true;";

            var context = new SoftUniDbContextClass(connectionParams);

            var emp1 = new Employee()
            {
                FirstName    = "I.",
                LastName     = "Ivanov",
                DepartmentId = context.Departments.First().Id,
                IsEmployed   = true,
            };

            context.Employees.Add(emp1);
            context.SaveChanges();

            var employee = context.Employees.Last();

            employee.FirstName = "Name";

            context.SaveChanges();
        }