本文整理汇总了C#中NHibernate.Mapping.PersistentClass类的典型用法代码示例。如果您正苦于以下问题:C# PersistentClass类的具体用法?C# PersistentClass怎么用?C# PersistentClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentClass类属于NHibernate.Mapping命名空间,在下文中一共展示了PersistentClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:27,代码来源:ClassIdBinder.cs
示例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;
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:CollectionBinder.cs
示例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;
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:CollectionBinder.cs
示例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;
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:CollectionBinder.cs
示例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;
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:CollectionBinder.cs
示例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;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:CollectionBinder.cs
示例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);
}
开发者ID:zibler,项目名称:zibler,代码行数:30,代码来源:UnionSubclassBinder.cs
示例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;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:CollectionBinder.cs
示例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;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:CollectionBinder.cs
示例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;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:CollectionBinder.cs
示例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 );
}
}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:40,代码来源:PersisterFactory.cs
示例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;
}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:26,代码来源:PocoEntityTuplizer.cs
示例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);
}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:30,代码来源:UnionSubclassBinder.cs
示例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);
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:31,代码来源:UnionSubclassBinder.cs
示例15: AnnotationsMetadataReader
public AnnotationsMetadataReader(GlobalConfiguration globalCfg, PersistentClass pc)
{
this.globalCfg = globalCfg;
this.pc = pc;
_auditData = new ClassAuditingData();
}
开发者ID:hazzik,项目名称:nhcontrib-all,代码行数:7,代码来源:AnnotationsMetadataReader.cs
示例16: BindTimestamp
private void BindTimestamp(HbmTimestamp timestampSchema, PersistentClass rootClass, Table table)
{
if (timestampSchema == null)
return;
string propertyName = timestampSchema.name;
SimpleValue simpleValue = new SimpleValue(table);
BindColumns(timestampSchema, simpleValue, propertyName);
if (!simpleValue.IsTypeSpecified)
simpleValue.TypeName = NHibernateUtil.Timestamp.Name;
Mapping.Property property = new Mapping.Property(simpleValue);
BindProperty(timestampSchema, property);
// for version properties marked as being generated, make sure they are "always"
// generated; "insert" is invalid. This is dis-allowed by the schema, but just to make
// sure...
if (property.Generation == PropertyGeneration.Insert)
throw new MappingException("'generated' attribute cannot be 'insert' for versioning property");
simpleValue.NullValue = timestampSchema.unsavedvalue;
rootClass.Version = property;
rootClass.AddProperty(property);
}
开发者ID:pallmall,项目名称:WCell,代码行数:27,代码来源:RootClassBinder.cs
示例17: GetClassTableName
private string GetClassTableName(PersistentClass model, HbmClass classSchema)
{
if (classSchema.table == null)
return mappings.NamingStrategy.ClassToTableName(model.EntityName);
else
return mappings.NamingStrategy.TableName(classSchema.table.Trim());
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:RootClassBinder.cs
示例18: CreateIdentifierProperty
private void CreateIdentifierProperty(HbmId idSchema, PersistentClass rootClass, SimpleValue id)
{
if (idSchema.name != null)
{
string access = idSchema.access ?? mappings.DefaultAccess;
id.SetTypeUsingReflection(rootClass.MappedClass.AssemblyQualifiedName, idSchema.name, access);
Mapping.Property property = new Mapping.Property(id);
property.Name = idSchema.name;
if (property.Value.Type == null)
throw new MappingException("could not determine a property type for: " + property.Name);
property.PropertyAccessorName = idSchema.access ?? mappings.DefaultAccess;
property.Cascade = mappings.DefaultCascade;
property.IsUpdateable = true;
property.IsInsertable = true;
property.IsOptimisticLocked = true;
property.Generation = PropertyGeneration.Never;
property.MetaAttributes = GetMetas(idSchema);
rootClass.IdentifierProperty = property;
LogMappedProperty(property);
}
}
开发者ID:pallmall,项目名称:WCell,代码行数:26,代码来源:ClassIdBinder.cs
示例19: Create
public Mapping.Collection Create(ICollectionPropertiesMapping collectionMapping, string className,
string propertyFullPath, PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas)
{
var collectionType = collectionMapping.GetType();
if (collectionType == typeof (HbmBag))
{
return CreateBag((HbmBag)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
else if (collectionType == typeof (HbmSet))
{
return CreateSet((HbmSet)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
else if (collectionType == typeof (HbmList))
{
return CreateList((HbmList)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
else if (collectionType == typeof (HbmMap))
{
return CreateMap((HbmMap)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
else if (collectionType == typeof (HbmIdbag))
{
return CreateIdentifierBag((HbmIdbag)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
else if (collectionType == typeof (HbmArray))
{
return CreateArray((HbmArray)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
else if (collectionType == typeof (HbmPrimitiveArray))
{
return CreatePrimitiveArray((HbmPrimitiveArray)collectionMapping, className, propertyFullPath, owner, containingType, inheritedMetas);
}
throw new MappingException("Not supported collection mapping element:" + collectionType);
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:34,代码来源:CollectionBinder.cs
示例20: BuildIdentifierProperty
/// <summary>
/// Generates an IdentifierProperty representation of the for a given entity mapping.
/// </summary>
/// <param name="mappedEntity">The mapping definition of the entity.</param>
/// <param name="generator">The identifier value generator to use for this identifier.</param>
/// <returns>The appropriate IdentifierProperty definition.</returns>
public static IdentifierProperty BuildIdentifierProperty(PersistentClass mappedEntity, IIdentifierGenerator generator)
{
string mappedUnsavedValue = mappedEntity.Identifier.NullValue;
IType type = mappedEntity.Identifier.Type;
Mapping.Property property = mappedEntity.IdentifierProperty;
Cascades.IdentifierValue unsavedValue = UnsavedValueFactory.GetUnsavedIdentifierValue(
mappedUnsavedValue,
GetGetter(property),
type,
GetConstructor(mappedEntity)
);
if (property == null)
{
// this is a virtual id property...
return new IdentifierProperty(
type,
mappedEntity.HasEmbeddedIdentifier,
unsavedValue,
generator
);
}
else
{
return new IdentifierProperty(
property.Name,
null, // TODO H3: property.NodeName,
type,
mappedEntity.HasEmbeddedIdentifier,
unsavedValue,
generator
);
}
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:41,代码来源:PropertyFactory.cs
注:本文中的NHibernate.Mapping.PersistentClass类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论