當前位置: 首頁>>代碼示例>>C#>>正文


C# PersistentClass.AddSubclass方法代碼示例

本文整理匯總了C#中NHibernate.Mapping.PersistentClass.AddSubclass方法的典型用法代碼示例。如果您正苦於以下問題:C# PersistentClass.AddSubclass方法的具體用法?C# PersistentClass.AddSubclass怎麽用?C# PersistentClass.AddSubclass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Mapping.PersistentClass的用法示例。


在下文中一共展示了PersistentClass.AddSubclass方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: HandleJoinedSubclass

		public void HandleJoinedSubclass(PersistentClass model, XmlNode subnode, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			JoinedSubclass subclass = new JoinedSubclass(model);

			BindClass(subnode, null, subclass, inheritedMetas);
			inheritedMetas = GetMetas(subnode.SelectNodes(HbmConstants.nsMeta, namespaceManager), inheritedMetas, true); // get meta's from <joined-subclass>
			// joined subclass
			if (subclass.EntityPersisterClass == null)
				subclass.RootClazz.EntityPersisterClass = typeof(JoinedSubclassEntityPersister);

			//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;

			XmlAttribute actionNode = subnode.Attributes["schema-action"];
			string action = actionNode == null ? "all" : actionNode.Value;
            
			Table mytable = mappings.AddTable(schema, catalog, GetClassTableName(subclass, subnode), null, false, action);
			((ITableOwner)subclass).Table = mytable;

			log.InfoFormat("Mapping joined-subclass: {0} -> {1}", subclass.EntityName, subclass.Table.Name);

			// KEY
			XmlNode keyNode = subnode.SelectSingleNode(HbmConstants.nsKey, namespaceManager);
			SimpleValue key = new DependantValue(mytable, subclass.Identifier);
			subclass.Key = key;
			if (keyNode.Attributes["on-delete"] != null)
				key.IsCascadeDeleteEnabled = "cascade".Equals(keyNode.Attributes["on-delete"].Value);
			BindSimpleValue(keyNode, key, false, subclass.EntityName);

			subclass.CreatePrimaryKey(dialect);

			if (!subclass.IsJoinedSubclass)
				throw new MappingException(
					"Cannot map joined-subclass " + subclass.EntityName + " to table " +
						subclass.Table.Name + ", the same table as its base class.");

			subclass.CreateForeignKey();

			// CHECK
			XmlAttribute chNode = subnode.Attributes["check"];
			if (chNode != null)
				mytable.AddCheckConstraint(chNode.Value);

			// properties
			PropertiesFromXML(subnode, subclass, inheritedMetas);

			model.AddSubclass(subclass);
			mappings.AddClass(subclass);
		}
開發者ID:hazzik,項目名稱:nh-contrib-everything,代碼行數:52,代碼來源:JoinedSubclassBinder.cs

示例5: HandleJoinedSubclass

		public void HandleJoinedSubclass(PersistentClass model, HbmJoinedSubclass joinedSubclassMapping, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			var subclass = new JoinedSubclass(model);

			BindClass(joinedSubclassMapping, subclass, inheritedMetas);
			inheritedMetas = GetMetas(joinedSubclassMapping, inheritedMetas, true); // get meta's from <joined-subclass>

			// joined subclass
			if (subclass.EntityPersisterClass == null)
				subclass.RootClazz.EntityPersisterClass = typeof(JoinedSubclassEntityPersister);

			//table + schema names
			string schema = joinedSubclassMapping.schema ?? mappings.SchemaName;
			string catalog = joinedSubclassMapping.catalog ?? mappings.CatalogName;

			// TODO: very strange, the schema does not support it
			//XmlAttribute actionNode = subnode.Attributes["schema-action"];
			//string action = actionNode == null ? "all" : actionNode.Value;
			string action = "all";

			Table mytable = mappings.AddTable(schema, catalog, GetClassTableName(subclass, joinedSubclassMapping.table), null, false, action);
			((ITableOwner)subclass).Table = mytable;

			log.InfoFormat("Mapping joined-subclass: {0} -> {1}", subclass.EntityName, subclass.Table.Name);

			// KEY
			BindKey(subclass, joinedSubclassMapping.key, mytable);

			subclass.CreatePrimaryKey(dialect);

			if (!subclass.IsJoinedSubclass)
				throw new MappingException(
					"Cannot map joined-subclass " + subclass.EntityName + " to table " +
						subclass.Table.Name + ", the same table as its base class.");

			subclass.CreateForeignKey();
			// CHECK
			mytable.AddCheckConstraint(joinedSubclassMapping.check);

			// properties
			new PropertiesBinder(mappings, subclass, dialect).Bind(joinedSubclassMapping.Properties, inheritedMetas);

			BindJoinedSubclasses(joinedSubclassMapping.JoinedSubclasses, subclass, inheritedMetas);

			model.AddSubclass(subclass);
			mappings.AddClass(subclass);
		}
開發者ID:paulbatum,項目名稱:nhibernate,代碼行數:47,代碼來源:JoinedSubclassBinder.cs

示例6: HandleSubclass

        public void HandleSubclass(PersistentClass model, XmlNode subnode)
        {
            Subclass subclass = new SingleTableSubclass(model);

            BindClass(subnode, subclass);

            if (subclass.EntityPersisterClass == null)
                subclass.RootClazz.EntityPersisterClass = typeof(SingleTableEntityPersister);

            log.InfoFormat("Mapping subclass: {0} -> {1}", subclass.EntityName, subclass.Table.Name);

            // properties
            PropertiesFromXML(subnode, subclass);

            model.AddSubclass(subclass);
            mappings.AddClass(subclass);
        }
開發者ID:zibler,項目名稱:zibler,代碼行數:17,代碼來源:SubclassBinder.cs

示例7: HandleSubclass

		public void HandleSubclass(PersistentClass model, XmlNode subnode, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			Subclass subclass = new SingleTableSubclass(model);

			BindClass(subnode, null, subclass, inheritedMetas);

			inheritedMetas = GetMetas(subnode.SelectNodes(HbmConstants.nsMeta, namespaceManager), inheritedMetas, true); // get meta's from <subclass>

			if (subclass.EntityPersisterClass == null)
				subclass.RootClazz.EntityPersisterClass = typeof(SingleTableEntityPersister);

			log.InfoFormat("Mapping subclass: {0} -> {1}", subclass.EntityName, subclass.Table.Name);

			// properties
			PropertiesFromXML(subnode, subclass, inheritedMetas);

			model.AddSubclass(subclass);
			mappings.AddClass(subclass);
		}
開發者ID:hazzik,項目名稱:nh-contrib-everything,代碼行數:19,代碼來源:SubclassBinder.cs

示例8: HandleSubclass

		public void HandleSubclass(PersistentClass model, HbmSubclass subClassMapping, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			Subclass subclass = new SingleTableSubclass(model);

			BindClass(subClassMapping, subclass, inheritedMetas);
			inheritedMetas = GetMetas(subClassMapping, inheritedMetas, true); // get meta's from <subclass>

			if (subclass.EntityPersisterClass == null)
				subclass.RootClazz.EntityPersisterClass = typeof(SingleTableEntityPersister);

			log.InfoFormat("Mapping subclass: {0} -> {1}", subclass.EntityName, subclass.Table.Name);

			// properties
			new PropertiesBinder(mappings, subclass, dialect).Bind(subClassMapping.Properties, inheritedMetas);
			BindJoins(subClassMapping.Joins, subclass, inheritedMetas);
			BindSubclasses(subClassMapping.Subclasses, subclass, inheritedMetas);

			model.AddSubclass(subclass);
			mappings.AddClass(subclass);
		}
開發者ID:KaraokeStu,項目名稱:nhibernate-core,代碼行數:20,代碼來源:SubclassBinder.cs

示例9: HandleSubclass

		private static void HandleSubclass( PersistentClass model, Mappings mappings, XmlNode subnode )
		{
			Subclass subclass = new Subclass( model );
			BindSubclass( subnode, subclass, mappings );
			model.AddSubclass( subclass );
			mappings.AddClass( subclass );
		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:7,代碼來源:Binder.cs


注:本文中的NHibernate.Mapping.PersistentClass.AddSubclass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。