本文整理汇总了C#中IModelInspector.GetVersionMember方法的典型用法代码示例。如果您正苦于以下问题:C# IModelInspector.GetVersionMember方法的具体用法?C# IModelInspector.GetVersionMember怎么用?C# IModelInspector.GetVersionMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModelInspector
的用法示例。
在下文中一共展示了IModelInspector.GetVersionMember方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapClass
/// <summary>
/// Maps a property according the naming conventions configuration
/// </summary>
/// <param name="modelInspector">The model inspector</param>
/// <param name="property">The class type</param>
/// <param name="mapper">The class mapper</param>
private void MapClass(IModelInspector modelInspector, Type classType, IClassAttributesMapper mapper)
{
Type entityType = classType.UnderlyingSystemType;
string schemaName = namingEngine.ToSchemaName(entityType) ?? mapper.GetSchema();
string tableName = namingEngine.ToTableName(entityType);
var idProperty = modelInspector.GetIdentifierMember(entityType);
var versionProperty = modelInspector.GetVersionMember(entityType);
string primaryKeyColumnName = namingEngine.ToPrimaryKeyColumnName(entityType, idProperty);
// Mapping
mapper.Schema(schemaName);
mapper.Table(tableName);
mapper.Id(id => id.Column(primaryKeyColumnName));
// Version mapping
if (versionProperty != null)
{
string versionColumnName = namingEngine.ToColumnName(versionProperty);
mapper.Version(versionProperty, m => m.Column(versionColumnName));
}
}