本文整理汇总了C#中NHibernate.Mapping.PersistentClass类的典型用法代码示例。如果您正苦于以下问题:C# PersistentClass类的具体用法?C# PersistentClass怎么用?C# PersistentClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentClass类属于NHibernate.Mapping命名空间,在下文中一共展示了PersistentClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindId
public void BindId(HbmId idSchema, PersistentClass rootClass, Table table)
{
if (idSchema != null)
{
var id = new SimpleValue(table);
new TypeBinder(id, Mappings).Bind(idSchema.Type);
rootClass.Identifier = id;
Func<HbmColumn> defaultColumn = () => new HbmColumn
{
name = idSchema.name ?? RootClass.DefaultIdentifierColumnName,
length = idSchema.length
};
new ColumnsBinder(id, Mappings).Bind(idSchema.Columns, false, defaultColumn);
CreateIdentifierProperty(idSchema, rootClass, id);
VerifiyIdTypeIsValid(id.Type, rootClass.EntityName);
new IdGeneratorBinder(Mappings).BindGenerator(id, GetIdGenerator(idSchema));
id.Table.SetIdentifierValue(id);
BindUnsavedValue(idSchema, id);
}
}
示例2: CreateList
private Mapping.Collection CreateList(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType)
{
List list = new List(owner);
BindCollection(node, list, prefix, path, containingType);
return list;
}
示例3: CreateIdentifierBag
private Mapping.Collection CreateIdentifierBag(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType)
{
IdentifierBag bag = new IdentifierBag(owner);
BindCollection(node, bag, prefix, path, containingType);
return bag;
}
示例4: CreateMap
private Mapping.Collection CreateMap(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType)
{
Map map = new Map(owner);
BindCollection(node, map, prefix, path, containingType);
return map;
}
示例5: CreateSet
private Mapping.Collection CreateSet(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType)
{
Set setCollection = new Set(owner);
BindCollection(node, setCollection, prefix, path, containingType);
return setCollection;
}
示例6: CreateIdentifierBag
private Mapping.Collection CreateIdentifierBag(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas)
{
IdentifierBag bag = new IdentifierBag(owner);
BindCollection(node, bag, prefix, path, containingType, inheritedMetas);
return bag;
}
示例7: HandleUnionSubclass
public void HandleUnionSubclass(PersistentClass model, XmlNode subnode)
{
UnionSubclass unionSubclass = new UnionSubclass(model);
BindClass(subnode, unionSubclass);
// union subclass
if (unionSubclass.EntityPersisterClass == null)
unionSubclass.RootClazz.EntityPersisterClass = typeof(UnionSubclassEntityPersister);
//table + schema names
XmlAttribute schemaNode = subnode.Attributes["schema"];
string schema = schemaNode == null ? mappings.SchemaName : schemaNode.Value;
XmlAttribute catalogNode = subnode.Attributes["catalog"];
string catalog = catalogNode == null ? mappings.CatalogName : catalogNode.Value;
Table denormalizedSuperTable = unionSubclass.Superclass.Table;
Table mytable =
mappings.AddDenormalizedTable(schema, catalog, GetClassTableName(unionSubclass, subnode),
unionSubclass.IsAbstract.GetValueOrDefault(), null, denormalizedSuperTable);
((ITableOwner)unionSubclass).Table = mytable;
log.InfoFormat("Mapping union-subclass: {0} -> {1}", unionSubclass.EntityName, unionSubclass.Table.Name);
// properties
PropertiesFromXML(subnode, unionSubclass);
model.AddSubclass(unionSubclass);
mappings.AddClass(unionSubclass);
}
示例8: CreateList
private Mapping.Collection CreateList(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas)
{
List list = new List(owner);
BindCollection(node, list, prefix, path, containingType, inheritedMetas);
return list;
}
示例9: CreateSet
private Mapping.Collection CreateSet(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas)
{
Set setCollection = new Set(owner);
BindCollection(node, setCollection, prefix, path, containingType, inheritedMetas);
return setCollection;
}
示例10: CreateMap
private Mapping.Collection CreateMap(XmlNode node, string prefix, string path,
PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas)
{
Map map = new Map(owner);
BindCollection(node, map, prefix, path, containingType, inheritedMetas);
return map;
}
示例11: Create
/// <summary>
/// Creates a specific Persister - could be a built in or custom persister.
/// </summary>
/// <param name="persisterClass"></param>
/// <param name="model"></param>
/// <param name="factory"></param>
/// <returns></returns>
public static IClassPersister Create( System.Type persisterClass, PersistentClass model, ISessionFactoryImplementor factory )
{
ConstructorInfo pc;
try
{
pc = persisterClass.GetConstructor( PersisterFactory.PersisterConstructorArgs );
}
catch( Exception e )
{
throw new MappingException( "Could not get constructor for " + persisterClass.Name, e );
}
try
{
return ( IClassPersister ) pc.Invoke( new object[ ] {model, factory} );
}
catch( TargetInvocationException tie )
{
Exception e = tie.InnerException;
if( e is HibernateException )
{
throw e;
}
else
{
throw new MappingException( "Could not instantiate persister " + persisterClass.Name, e );
}
}
catch( Exception e )
{
throw new MappingException( "Could not instantiate persister " + persisterClass.Name, e );
}
}
示例12: PocoEntityTuplizer
public PocoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
: base(entityMetamodel, mappedEntity)
{
mappedClass = mappedEntity.MappedClass;
proxyInterface = mappedEntity.ProxyInterface;
islifecycleImplementor = typeof(ILifecycle).IsAssignableFrom(mappedClass);
isValidatableImplementor = typeof(IValidatable).IsAssignableFrom(mappedClass);
foreach (Mapping.Property property in mappedEntity.PropertyClosureIterator)
{
if (property.IsLazy)
lazyPropertyNames.Add(property.Name);
if (property.UnwrapProxy)
unwrapProxyPropertyNames.Add(property.Name);
}
SetReflectionOptimizer();
Instantiator = BuildInstantiator(mappedEntity);
if (hasCustomAccessors)
{
optimizer = null;
}
proxyValidator = Cfg.Environment.BytecodeProvider.ProxyFactoryFactory.ProxyValidator;
}
示例13: HandleUnionSubclass
public void HandleUnionSubclass(PersistentClass model, HbmUnionSubclass unionSubclassMapping, IDictionary<string, MetaAttribute> inheritedMetas)
{
var unionSubclass = new UnionSubclass(model);
BindClass(unionSubclassMapping, unionSubclass, inheritedMetas);
inheritedMetas = GetMetas(unionSubclassMapping, inheritedMetas, true); // get meta's from <union-subclass>
// union subclass
if (unionSubclass.EntityPersisterClass == null)
unionSubclass.RootClazz.EntityPersisterClass = typeof(UnionSubclassEntityPersister);
//table + schema names
string schema = unionSubclassMapping.schema ?? mappings.SchemaName;
string catalog = unionSubclassMapping.catalog ?? mappings.CatalogName;
Table denormalizedSuperTable = unionSubclass.Superclass.Table;
Table mytable =
mappings.AddDenormalizedTable(schema, catalog, GetClassTableName(unionSubclass, unionSubclassMapping.table),
unionSubclass.IsAbstract.GetValueOrDefault(), null, denormalizedSuperTable);
((ITableOwner)unionSubclass).Table = mytable;
log.InfoFormat("Mapping union-subclass: {0} -> {1}", unionSubclass.EntityName, unionSubclass.Table.Name);
// properties
new PropertiesBinder(mappings, unionSubclass, dialect).Bind(unionSubclassMapping.Properties, inheritedMetas);
BindUnionSubclasses(unionSubclassMapping.UnionSubclasses, unionSubclass, inheritedMetas);
model.AddSubclass(unionSubclass);
mappings.AddClass(unionSubclass);
}
示例14: HandleUnionSubclass
public void HandleUnionSubclass(PersistentClass model, XmlNode subnode, IDictionary<string, MetaAttribute> inheritedMetas)
{
var unionSubclass = new UnionSubclass(model);
BindClass(subnode, null, unionSubclass, inheritedMetas);
inheritedMetas = GetMetas(subnode.SelectNodes(HbmConstants.nsMeta, namespaceManager), inheritedMetas, true); // get meta's from <union-subclass>
// union subclass
if (unionSubclass.EntityPersisterClass == null)
unionSubclass.RootClazz.EntityPersisterClass = typeof(UnionSubclassEntityPersister);
//table + schema names
XmlAttribute schemaNode = subnode.Attributes["schema"];
string schema = schemaNode == null ? mappings.SchemaName : schemaNode.Value;
XmlAttribute catalogNode = subnode.Attributes["catalog"];
string catalog = catalogNode == null ? mappings.CatalogName : catalogNode.Value;
Table denormalizedSuperTable = unionSubclass.Superclass.Table;
Table mytable =
mappings.AddDenormalizedTable(schema, catalog, GetClassTableName(unionSubclass, subnode),
unionSubclass.IsAbstract.GetValueOrDefault(), null, denormalizedSuperTable);
((ITableOwner)unionSubclass).Table = mytable;
log.InfoFormat("Mapping union-subclass: {0} -> {1}", unionSubclass.EntityName, unionSubclass.Table.Name);
// properties
PropertiesFromXML(subnode, unionSubclass, inheritedMetas);
model.AddSubclass(unionSubclass);
mappings.AddClass(unionSubclass);
}
示例15: AnnotationsMetadataReader
public AnnotationsMetadataReader(GlobalConfiguration globalCfg, PersistentClass pc)
{
this.globalCfg = globalCfg;
this.pc = pc;
_auditData = new ClassAuditingData();
}