public virtual SqlEntityDefinitionExpression ResolveSimpleTableInfo (
IResolvedTableInfo tableInfo, UniqueIdentifierGenerator generator)
{
Type type = tableInfo.ItemType;
if (type == typeof (Cook))
{
return new SqlEntityDefinitionExpression (
tableInfo.ItemType,
tableInfo.TableAlias, null,
e => e.GetColumn (typeof (int), "ID", true),
new[]
{
CreateColumn (typeof (int), tableInfo.TableAlias, "ID", true),
CreateColumn (typeof (string), tableInfo.TableAlias, "FirstName", false),
CreateColumn (typeof (string), tableInfo.TableAlias, "Name", false),
CreateColumn (typeof (bool), tableInfo.TableAlias, "IsStarredCook", false),
CreateColumn (typeof (bool), tableInfo.TableAlias, "IsFullTimeCook", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "SubstitutedID", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "KitchenID", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "KnifeID", false),
CreateColumn (typeof (string), tableInfo.TableAlias, "KnifeClassID", false)
});
}
else if (type == typeof (Kitchen))
{
return new SqlEntityDefinitionExpression (
tableInfo.ItemType,
tableInfo.TableAlias, null,
e => e.GetColumn (typeof (int), "ID", true),
new[]
{
CreateColumn (typeof (int), tableInfo.TableAlias, "ID", true),
CreateColumn (typeof (string), tableInfo.TableAlias, "Name", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "RestaurantID", false),
CreateColumn (typeof (DateTime?), tableInfo.TableAlias, "LastCleaningDay", false),
CreateColumn (typeof (bool?), tableInfo.TableAlias, "PassedLastInspection", false),
CreateColumn (typeof (int?), tableInfo.TableAlias, "LastInspectionScore", false)
});
}
else if (type == typeof (Restaurant))
{
return new SqlEntityDefinitionExpression (
tableInfo.ItemType,
tableInfo.TableAlias, null,
e => e.GetColumn (typeof (int), "ID", true),
new[]
{
CreateColumn (typeof (int), tableInfo.TableAlias, "ID", true),
CreateColumn (typeof (int), tableInfo.TableAlias, "CompanyID", false)
});
}
else if (type == typeof (Chef))
{
return new SqlEntityDefinitionExpression (
tableInfo.ItemType,
tableInfo.TableAlias, null,
e => e.GetColumn (typeof (int), "ID", true),
new[]
{
CreateColumn (typeof (int), tableInfo.TableAlias, "ID", true),
CreateColumn (typeof (string), tableInfo.TableAlias, "FirstName", false),
CreateColumn (typeof (string), tableInfo.TableAlias, "Name", false),
CreateColumn (typeof (bool), tableInfo.TableAlias, "IsStarredCook", false),
CreateColumn (typeof (bool), tableInfo.TableAlias, "IsFullTimeCook", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "SubstitutedID", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "KitchenID", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "KnifeID", false),
CreateColumn (typeof (int), tableInfo.TableAlias, "KnifeClassID", false),
CreateColumn (typeof (string), tableInfo.TableAlias, "LetterOfRecommendation", false)
});
}
else if (type == typeof (Company))
{
return new SqlEntityDefinitionExpression (
tableInfo.ItemType,
tableInfo.TableAlias, null,
e => e.GetColumn (typeof (int), "ID", true),
new[]
{
CreateColumn (typeof (int), tableInfo.TableAlias, "ID", true),
CreateColumn (typeof (DateTime), tableInfo.TableAlias, "DateOfIncorporation", false)
});
}
else if (type == typeof (Knife))
{
return new SqlEntityDefinitionExpression (
tableInfo.ItemType,
tableInfo.TableAlias, null,
e => CreateMetaIDExpression (e.GetColumn (typeof (int), "ID", true), e.GetColumn (typeof (string), "ClassID", true)),
new[]
{
CreateColumn (typeof (int), tableInfo.TableAlias, "ID", true),
CreateColumn (typeof (string), tableInfo.TableAlias, "ClassID", true),
CreateColumn (typeof (double), tableInfo.TableAlias, "Sharpness", false)
});
}
throw new UnmappedItemException (string.Format ("Type '{0}' is not supported by the MappingResolverStub.", type.Name));
}