本文整理汇总了C#中FluentNHibernate.MappingModel.ClassBased.ClassMappingBase类的典型用法代码示例。如果您正苦于以下问题:C# ClassMappingBase类的具体用法?C# ClassMappingBase怎么用?C# ClassMappingBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassMappingBase类属于FluentNHibernate.MappingModel.ClassBased命名空间,在下文中一共展示了ClassMappingBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Map
public void Map(ClassMappingBase classMap, Member member)
{
if (!(classMap is ClassMapping)) return;
var version = new VersionMapping
{
ContainingEntityType = classMap.Type,
};
version.Set(x => x.Name, Layer.Defaults, member.Name);
version.Set(x => x.Type, Layer.Defaults, GetDefaultType(member));
var columnMapping = new ColumnMapping();
columnMapping.Set(x => x.Name, Layer.Defaults, member.Name);
version.AddColumn(Layer.Defaults, columnMapping);
SetDefaultAccess(member, version);
if (IsSqlTimestamp(member))
{
version.Columns.Each(column =>
{
column.Set(x => x.SqlType, Layer.Defaults, "timestamp");
column.Set(x => x.NotNull, Layer.Defaults, true);
});
version.Set(x => x.UnsavedValue, Layer.Defaults, null);
}
((ClassMapping)classMap).Set(x => x.Version, Layer.Defaults, version);
}
开发者ID:jjchoi,项目名称:fluent-nhibernate,代码行数:28,代码来源:VersionStep.cs
示例2: MapEverythingInClass
public virtual void MapEverythingInClass(ClassMappingBase mapping, Type entityType, IList<string> mappedProperties)
{
foreach (var property in entityType.GetProperties())
{
TryToMapProperty(mapping, property.ToMember(), mappedProperties);
}
}
开发者ID:Kaidanov,项目名称:fluent-nhibernate,代码行数:7,代码来源:AutoMapper.cs
示例3: Map
public void Map(ClassMappingBase classMap, Member member)
{
if (!(classMap is ClassMapping)) return;
var version = new VersionMapping
{
Name = member.Name,
ContainingEntityType = classMap.Type,
};
version.SetDefaultValue("Type", GetDefaultType(member));
version.AddDefaultColumn(new ColumnMapping { Name = member.Name });
if (member.IsProperty && !member.CanWrite)
version.Access = cfg.GetAccessStrategyForReadOnlyProperty(member).ToString();
if (IsSqlTimestamp(member))
{
version.Columns.Each(x =>
{
x.SqlType = "timestamp";
x.NotNull = true;
});
version.UnsavedValue = null;
}
((ClassMapping)classMap).Version = version;
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:28,代码来源:VersionStep.cs
示例4: Map
public void Map(ClassMappingBase classMap, PropertyInfo property)
{
if (property.DeclaringType != classMap.Type || !(classMap is ClassMapping))
return;
var version = new VersionMapping
{
Name = property.Name,
};
version.SetDefaultValue("Type", GetDefaultType(property));
version.AddDefaultColumn(new ColumnMapping { Name = property.Name });
if (IsSqlTimestamp(property))
{
version.Columns.Each(x =>
{
x.SqlType = "timestamp";
x.NotNull = true;
});
version.UnsavedValue = null;
}
((ClassMapping)classMap).Version = version;
}
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:25,代码来源:AutoMapVersion.cs
示例5: MapInheritanceTree
private void MapInheritanceTree(Type classType, ClassMappingBase mapping, IList<Member> mappedMembers)
{
var discriminatorSet = HasDiscriminator(mapping);
var isDiscriminated = cfg.IsDiscriminated(classType) || discriminatorSet;
var mappingTypesWithLogicalParents = GetMappingTypesWithLogicalParents();
foreach (var inheritedClass in mappingTypesWithLogicalParents
.Where(x => x.Value != null && x.Value.Type == classType)
.Select(x => x.Key))
{
var tempMapping = mapping as ClassMapping;
var tempIsNull = tempMapping == null;
if (isDiscriminated && !discriminatorSet && !tempIsNull)
{
var discriminatorColumn = cfg.GetDiscriminatorColumn(classType);
var discriminator = new DiscriminatorMapping
{
ContainingEntityType = classType,
Type = new TypeReference(typeof(string))
};
discriminator.AddDefaultColumn(new ColumnMapping { Name = discriminatorColumn });
tempMapping.Discriminator = discriminator;
discriminatorSet = true;
}
SubclassMapping subclassMapping;
if(!tempIsNull && tempMapping.IsUnionSubclass)
{
subclassMapping = new SubclassMapping(SubclassType.UnionSubclass)
{
Type = inheritedClass.Type
};
}
else if(!isDiscriminated)
{
subclassMapping = new SubclassMapping(SubclassType.JoinedSubclass)
{
Type = inheritedClass.Type
};
subclassMapping.Key = new KeyMapping();
subclassMapping.Key.AddDefaultColumn(new ColumnMapping { Name = mapping.Type.Name + "_id" });
}
else
subclassMapping = new SubclassMapping(SubclassType.Subclass)
{
Type = inheritedClass.Type
};
// track separate set of properties for each sub-tree within inheritance hierarchy
var subclassMembers = new List<Member>(mappedMembers);
MapSubclass(subclassMembers, subclassMapping, inheritedClass);
mapping.AddSubclass(subclassMapping);
MergeMap(inheritedClass.Type, subclassMapping, subclassMembers);
}
}
开发者ID:henriksen,项目名称:fluent-nhibernate,代码行数:59,代码来源:AutoMapper.cs
示例6: ProcessClassBase
protected override void ProcessClassBase(ClassMappingBase classMapping)
{
if (!classMapping.IsNameSpecified)
{
if (classMapping.Type == null)
throw new ConventionException("Cannot apply the naming convention. No type specified.", classMapping);
classMapping.Name = DetermineNameFromType(classMapping.Type);
}
}
开发者ID:HudsonAkridge,项目名称:fluent-nhibernate,代码行数:9,代码来源:NamingConvention.cs
示例7: Map
public void Map(ClassMappingBase classMap, Member member)
{
// don't map the component here, mark it as a reference which'll
// allow us to integrate with ComponentMap or automap at a later
// stage
var mapping = new ReferenceComponentMapping(ComponentType.Component, member, member.PropertyType, classMap.Type, cfg.GetComponentColumnPrefix(member));
classMap.AddComponent(mapping);
}
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:9,代码来源:ComponentStep.cs
示例8: Map
public void Map(ClassMappingBase classMap, Member member)
{
if (!(classMap is ClassMapping)) {
return;
}
var identity = ((ClassMapping) classMap).Id;
if (identity == null) {
var idMapping = new IdMapping {ContainingEntityType = classMap.Type};
var columnMapping = new ColumnMapping();
columnMapping.Set(x => x.Name, Layer.Defaults, member.Name);
idMapping.AddColumn(Layer.Defaults, columnMapping);
idMapping.Set(x => x.Name, Layer.Defaults, member.Name);
idMapping.Set(x => x.Type, Layer.Defaults, new TypeReference(member.PropertyType));
idMapping.Member = member;
idMapping.Set(x => x.Generator, Layer.Defaults, GetDefaultGenerator(member));
SetDefaultAccess(member, idMapping);
identity = idMapping;
}
else {
if (identity is IdMapping) {
var idMapping = identity as IdMapping;
var compositeId = new CompositeIdMapping {ContainingEntityType = classMap.Type};
var idKeyPropertyMapping = GetKeyPropertyMapping(classMap.Type, idMapping.Name,
idMapping.Type.GetUnderlyingSystemType());
var keyPropertyMapping = GetKeyPropertyMapping(classMap.Type, member.Name,
member.PropertyType);
compositeId.AddKey(idKeyPropertyMapping);
compositeId.AddKey(keyPropertyMapping);
identity = compositeId;
}
else if (identity is CompositeIdMapping) {
var compositeId = identity as CompositeIdMapping;
var keyPropertyMapping = GetKeyPropertyMapping(classMap.Type, member.Name,
member.PropertyType);
compositeId.AddKey(keyPropertyMapping);
identity = compositeId;
}
else {
throw new NotImplementedException(
string.Format("Mayank: Fluent nhibernate not exended to support type '{0}'",
identity.GetType().Name));
}
}
((ClassMapping) classMap).Set(x => x.Id, Layer.Defaults, identity);
}
开发者ID:umittal,项目名称:MunimJi,代码行数:56,代码来源:IdentityStep.cs
示例9: SetRelationship
private void SetRelationship(Member property, ClassMappingBase classMap, ICollectionMapping mapping)
{
var relationship = new OneToManyMapping
{
Class = new TypeReference(property.PropertyType.GetGenericArguments()[0]),
ContainingEntityType = classMap.Type
};
mapping.SetDefaultValue(x => x.Relationship, relationship);
}
开发者ID:erikojebo,项目名称:fluent-nhibernate,代码行数:10,代码来源:CollectionStep.cs
示例10: SetKey
private void SetKey(Member property, ClassMappingBase classMap, ICollectionMapping mapping)
{
var columnName = property.DeclaringType.Name + "_id";
var key = new KeyMapping();
key.ContainingEntityType = classMap.Type;
key.AddDefaultColumn(new ColumnMapping { Name = columnName });
mapping.SetDefaultValue(x => x.Key, key);
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:10,代码来源:HasManyToManyStep.cs
示例11: Map
public void Map(ClassMappingBase classMap, Member property)
{
var inverseProperty = GetInverseProperty(property);
var parentSide = expressions.GetParentSideForManyToMany(property.DeclaringType, inverseProperty.DeclaringType);
var mapping = GetCollection(property);
ConfigureModel(property, mapping, classMap, parentSide);
classMap.AddCollection(mapping);
}
开发者ID:AndyStewart,项目名称:fluent-nhibernate,代码行数:10,代码来源:AutoMapManyToMany.cs
示例12: Map
public void Map(ClassMappingBase classMap, Member member)
{
if (member.DeclaringType != classMap.Type)
return;
if (simpleTypeCollectionStepStep.ShouldMap(member))
simpleTypeCollectionStepStep.Map(classMap, member);
else if (collectionStep.ShouldMap(member))
collectionStep.Map(classMap, member);
}
开发者ID:akhuang,项目名称:NHibernateTest,代码行数:10,代码来源:HasManyStep.cs
示例13: Map
public void Map(ClassMappingBase classMap, Member member)
{
var inverseProperty = GetInverseProperty(member);
var parentSide = cfg.GetParentSideForManyToMany(member.DeclaringType, inverseProperty.DeclaringType);
var mapping = GetCollection(member);
ConfigureModel(member, mapping, classMap, parentSide);
classMap.AddCollection(mapping);
}
开发者ID:akhuang,项目名称:NHibernateTest,代码行数:10,代码来源:HasManyToManyStep.cs
示例14: Map
public void Map(ClassMappingBase classMap, Member property)
{
if (property.DeclaringType != classMap.Type)
return;
if (simpleTypeCollectionStep.MapsProperty(property))
simpleTypeCollectionStep.Map(classMap, property);
else if (entityCollectionStep.MapsProperty(property))
entityCollectionStep.Map(classMap, property);
}
开发者ID:jamesfoster,项目名称:fluent-nhibernate,代码行数:10,代码来源:AutoMapOneToMany.cs
示例15: SetRelationship
static void SetRelationship(Member property, ClassMappingBase classMap, CollectionMapping mapping)
{
var relationship = new OneToManyMapping
{
ContainingEntityType = classMap.Type
};
relationship.Set(x => x.Class, Layer.Defaults, new TypeReference(property.PropertyType.GetGenericArguments()[0]));
mapping.Set(x => x.Relationship, Layer.Defaults, relationship);
}
开发者ID:nsreddy1986,项目名称:fluent-nhibernate,代码行数:10,代码来源:CollectionStep.cs
示例16: ApplyOverrides
private void ApplyOverrides(Type classType, IList<Member> mappedMembers, ClassMappingBase mapping)
{
var autoMapType = ReflectionHelper.AutomappingTypeForEntityType(classType);
var autoMap = Activator.CreateInstance(autoMapType, mappedMembers);
inlineOverrides
.Where(x => x.CanOverride(classType))
.Each(x => x.Apply(autoMap));
((IAutoClasslike)autoMap).AlterModel(mapping);
}
开发者ID:oblivious,项目名称:Oblivious,代码行数:11,代码来源:AutoMapper.cs
示例17: Map
public void Map(ClassMappingBase classMap, PropertyInfo property)
{
if (property.DeclaringType != classMap.Type || !(classMap is ClassMapping))
return;
((ClassMapping)classMap).Version = new VersionMapping
{
Name = property.Name,
Column = property.Name
};
}
开发者ID:sbakshi,项目名称:fluent-nhibernate,代码行数:11,代码来源:AutoMapVersion.cs
示例18: SetKey
private static void SetKey(Member property, ClassMappingBase classMap, CollectionMapping mapping)
{
var ColumnName = "Id_"+property.DeclaringType.Name;
var ColumnMapping = new ColumnMapping();
ColumnMapping.Set(x => x.Name, Layer.Defaults, ColumnName);
var Key = new KeyMapping {ContainingEntityType = classMap.Type};
Key.AddColumn(Layer.Defaults, ColumnMapping);
mapping.Set(x => x.Key, Layer.Defaults, Key);
}
开发者ID:rodolpholl,项目名称:bakerymanager,代码行数:11,代码来源:CustomHasManyToManyStep.cs
示例19: ApplyOverrides
private void ApplyOverrides(Type classType, IList<Member> mappedMembers, ClassMappingBase mapping)
{
var autoMapType = typeof(AutoMapping<>).MakeGenericType(classType);
var autoMap = Activator.CreateInstance(autoMapType, mappedMembers);
inlineOverrides
.Where(x => x.CanOverride(classType))
.Each(x => x.Apply(autoMap));
((IAutoClasslike)autoMap).AlterModel(mapping);
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:11,代码来源:AutoMapper.cs
示例20: SetElement
private void SetElement(Member property, ClassMappingBase classMap, ICollectionMapping mapping)
{
var element = new ElementMapping
{
ContainingEntityType = classMap.Type,
Type = new TypeReference(property.PropertyType.GetGenericArguments()[0])
};
element.AddDefaultColumn(new ColumnMapping { Name = cfg.SimpleTypeCollectionValueColumn(property) });
mapping.SetDefaultValue(x => x.Element, element);
}
开发者ID:roelofb,项目名称:fluent-nhibernate,代码行数:11,代码来源:SimpleTypeCollectionStep.cs
注:本文中的FluentNHibernate.MappingModel.ClassBased.ClassMappingBase类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论