本文整理汇总了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},
}
};
}
示例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},
}
}
};
}
示例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},
}
};
}