当前位置: 首页>>代码示例>>C#>>正文


C# IDatabase.RetrieveObject方法代码示例

本文整理汇总了C#中IDatabase.RetrieveObject方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.RetrieveObject方法的具体用法?C# IDatabase.RetrieveObject怎么用?C# IDatabase.RetrieveObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDatabase的用法示例。


在下文中一共展示了IDatabase.RetrieveObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFakeEmployee

        public static Employee GetFakeEmployee(IDatabase database)
        {
           var program1 = database.RetrieveObject<Program>( p => p.Name == "Kitchen Life");
           var  program2 = database.RetrieveObject<Program>(p => p.Name == "Gardening");

            return new Employee
                {
                    FirstName = "david",
                    LastName = "smith",
                    Identifier =  Guid.NewGuid(),
                    Salary = 12045.27M,
                    EmployedSince = new DateTime(2010, 3, 12),
 
                    Active = true,
                    Age=41,
                    Department = new LookupBL(database).RetrieveLookupByName(Department.IT.ToString()),
                    Role = new LookupBL(database).RetrieveLookupByName(Role.Employee.ToString()),
                    Email = "[email protected]",
                    Phone = "403-245-4781",
                    Address = new Address
                        {
                            Country = new LookupBL(database).RetrieveLookupByName(Country.China.ToString()),
                            HouseNumber = "195",
                            PostalCode = "T2Y 3S9",
                            StreetName = "Bridlewood Way"
                        },
                    Programs = new List<EmployeeProgram>
                        {
                            new EmployeeProgram {ProgramId = program1.Id, Status = ProgramStatus.Registered},
                            new EmployeeProgram {ProgramId = program2.Id, Status = ProgramStatus.Completed},
                        }
                };
        }
开发者ID:EasyExpress,项目名称:Easylink,代码行数:33,代码来源:FakeEmployee.cs

示例2: GetFakeEmployees

        public static List<Employee> GetFakeEmployees(IDatabase database)
        {
            var   program1 = database.RetrieveObject<Program>(p => p.Name == "IT Infrastructure");
            var   program2 = database.RetrieveObject<Program>(p => p.Name == "Kitchen Life");
            var   program3 = database.RetrieveObject<Program>(p => p.Name ==  "Gardening");
            var   program4 = database.RetrieveObject<Program>(p => p.Name == "Financial Planning");


            return new List<Employee>
                {
                    new Employee
                        {
                            FirstName = "david",
                            LastName = "smith",
                            Salary = 12045.27M,
                            EmployedSince = new DateTime(2010, 3, 12),
                            Active = true,
                            Department = new LookupBL(database).RetrieveLookupByName(Department.IT.ToString()),
                            Programs = new List<EmployeeProgram>
                                {
                                    new EmployeeProgram {ProgramId = program1.Id, Status = ProgramStatus.Registered},
                                    new EmployeeProgram {ProgramId = program3.Id, Status = ProgramStatus.Completed},
                                }
                        },
                    new Employee
                        {
                            FirstName = "vincient",
                            LastName = "john",
                            Salary = 11045.39M,
                            EmployedSince = new DateTime(2011, 5, 6),
                            Active = false,
                            Department = new LookupBL(database).RetrieveLookupByName(Department.Admin.ToString()),
                            Programs = new List<EmployeeProgram>
                                {
                                    new EmployeeProgram {ProgramId = program2.Id, Status = ProgramStatus.Completed},
                                    new EmployeeProgram {ProgramId = program4.Id, Status = ProgramStatus.InProgress},
                                }
                        }
                };
        }
开发者ID:EasyExpress,项目名称:Easylink,代码行数:40,代码来源:FakeEmployee.cs

示例3: GetFakeEmployee1

        public static Employee GetFakeEmployee1(IDatabase database)
        {
            var  program1 = database.RetrieveObject<Program>(p => p.Name == "Kitchen Life");
            var  program2 = database.RetrieveObject<Program>(p => p.Name == "Gardening");


            return new Employee
                {
                    FirstName = "david",
                    LastName = "smith",
                    Salary = 12045.27M,
                    EmployedSince = new DateTime(2010, 3, 12),
                    Active = true,
                    Department = new LookupBL(database).RetrieveLookupByName(Department.IT.ToString()),
                    Role = new LookupBL(database).RetrieveLookupByName(Role.Employee.ToString()),
                    Address = new Address {HouseNumber = "31", PostalCode = "T2Y WS2", StreetName = "Centre Street"},
                    Programs = new List<EmployeeProgram>
                        {
                            new EmployeeProgram {ProgramId = program1.Id, Status = ProgramStatus.Registered},
                            new EmployeeProgram {ProgramId = program2.Id, Status = ProgramStatus.Completed},
                        }
                };
        }
开发者ID:EasyExpress,项目名称:Easylink,代码行数:23,代码来源:FakeEmployee.cs


注:本文中的IDatabase.RetrieveObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。