本文整理汇总了C#中IPropertyMap.GetTableMap方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertyMap.GetTableMap方法的具体用法?C# IPropertyMap.GetTableMap怎么用?C# IPropertyMap.GetTableMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyMap
的用法示例。
在下文中一共展示了IPropertyMap.GetTableMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyTable
private void VerifyTable(IPropertyMap propertyMap)
{
IColumnMap colMap;
if (propertyMap.Table.Length > 0)
{
if (propertyMap.GetTableMap() == null)
{
HandleVerifyException(propertyMap, "Table not found! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Table: '" + propertyMap.Table + "')", "Table"); // do not localize
}
if (propertyMap.IdColumn.Length < 1)
{
HandleVerifyException(propertyMap, "Non-primary property must map to id column! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "')", "IdColumn"); // do not localize
}
colMap = propertyMap.GetIdColumnMap();
if (colMap != null)
{
if (!(colMap.IsForeignKey))
{
HandleVerifyException(propertyMap, "Non-primary property id column must be marked as foreign key! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Id Column: '" + propertyMap.IdColumn + "')", "IdColumn"); // do not localize
}
}
}
}
示例2: VerifyAdditionalIDColumns
protected virtual void VerifyAdditionalIDColumns(IPropertyMap propertyMap)
{
IColumnMap colMap;
ITableMap tableMap;
if (propertyMap.AdditionalIdColumns.Count > 0)
{
if (!((propertyMap.ReferenceType != ReferenceType.None || propertyMap.IsCollection || propertyMap.Table.Length > 0)))
{
HandleVerifyException(propertyMap, "Only reference, collection or non-primary propertyies should have additional id columns specified! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "')", "AdditionalIdColumns"); // do not localize
}
tableMap = propertyMap.GetTableMap();
if (tableMap != null)
{
foreach (string colName in propertyMap.AdditionalIdColumns)
{
colMap = tableMap.GetColumnMap(colName);
if (colMap == null)
{
HandleVerifyException(propertyMap, "Additional id column not found! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Additional Id Column: '" + colName + "')", "AdditionalIdColumns"); // do not localize
}
else
{
if (!(colMap.IsForeignKey))
{
HandleVerifyException(propertyMap, "Additional id column must be a foreign key! (Class: '" + propertyMap.ClassMap.Name + "', Property: '" + propertyMap.Name + "', Additional Id Column: '" + colName + "')", "AdditionalIdColumns"); // do not localize
}
}
}
}
}
}
示例3: CreateInverseProperty
private void CreateInverseProperty(IPropertyMap propertyMap, Hashtable newInverseProperties)
{
if (propertyMap.ReferenceType.Equals(ReferenceType.None))
return;
if (propertyMap.GetInversePropertyMap() != null)
return;
if (propertyMap.NoInverseManagement)
return;
if (propertyMap.GetTableMap() == null)
return;
IClassMap refClassMap = propertyMap.MustGetReferencedClassMap();
if (!(refClassMap.ClassType.Equals(ClassType.Class) || refClassMap.ClassType.Equals(ClassType.Default)))
return;
string inverseName = propertyMap.Inverse;
if (inverseName == "")
{
inverseName = "NPersistInverseOf" + propertyMap.ClassMap.Name + propertyMap.Name;
propertyMap.Inverse = inverseName;
}
IPropertyMap inversePropertyMap = new PropertyMap(inverseName);
string dataType = propertyMap.ClassMap.GetFullName();
inversePropertyMap.Inverse = propertyMap.Name;
inversePropertyMap.InheritInverseMappings = true;
propertyMap.InheritInverseMappings = false;
inversePropertyMap.Accessibility = AccessibilityType.ProtectedAccess;
inversePropertyMap.IsGenerated = true;
switch (propertyMap.ReferenceType)
{
case ReferenceType.ManyToMany:
inversePropertyMap.ReferenceType = ReferenceType.ManyToMany;
inversePropertyMap.ItemType = dataType;
inversePropertyMap.IsCollection = true;
inversePropertyMap.IsSlave = !propertyMap.IsSlave;
break;
case ReferenceType.ManyToOne:
inversePropertyMap.ReferenceType = ReferenceType.OneToMany;
inversePropertyMap.DataType = dataType;
inversePropertyMap.IsSlave = false;
propertyMap.IsSlave = true;
break;
case ReferenceType.OneToMany:
inversePropertyMap.ReferenceType = ReferenceType.ManyToOne;
inversePropertyMap.ItemType = dataType;
inversePropertyMap.IsCollection = true;
inversePropertyMap.IsSlave = true;
propertyMap.IsSlave = false;
break;
case ReferenceType.OneToOne:
inversePropertyMap.ReferenceType = ReferenceType.OneToOne;
inversePropertyMap.DataType = dataType;
inversePropertyMap.IsSlave = !propertyMap.IsSlave;
if (!propertyMap.IsSlave)
inversePropertyMap.IsNullable = true;
break;
}
if (!newInverseProperties.ContainsKey(refClassMap))
newInverseProperties[refClassMap] = new ArrayList();
IList propertiesForClass = (IList) newInverseProperties[refClassMap];
propertiesForClass.Add(inversePropertyMap);
}