当前位置: 首页>>代码示例>>C#>>正文


C# Mapping.PersistentClass类代码示例

本文整理汇总了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);
			}
		}
开发者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


注:本文中的NHibernate.Mapping.PersistentClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。