當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。