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


C# PersistentClass.AddSynchronizedTable方法代码示例

本文整理汇总了C#中NHibernate.Mapping.PersistentClass.AddSynchronizedTable方法的典型用法代码示例。如果您正苦于以下问题:C# PersistentClass.AddSynchronizedTable方法的具体用法?C# PersistentClass.AddSynchronizedTable怎么用?C# PersistentClass.AddSynchronizedTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.Mapping.PersistentClass的用法示例。


在下文中一共展示了PersistentClass.AddSynchronizedTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BindClass

        protected void BindClass(XmlNode node, PersistentClass model)
        {
            string className = node.Attributes["name"] == null ? null : FullClassName(node.Attributes["name"].Value, mappings);

            // CLASS
            model.ClassName = ClassForFullNameChecked(className, "persistent class {0} not found").AssemblyQualifiedName;

            string entityName = node.Attributes["entity-name"] == null ? null : node.Attributes["name"].Value;
            if (entityName == null)
                entityName = model.MappedClass.FullName;
            if (entityName == null)
            {
                throw new MappingException("Unable to determine entity name");
            }
            model.EntityName = entityName;

            // PROXY INTERFACE
            XmlAttribute proxyNode = node.Attributes["proxy"];
            XmlAttribute lazyNode = node.Attributes["lazy"];
            bool lazy = lazyNode == null ? mappings.DefaultLazy : "true".Equals(lazyNode.Value);

            // go ahead and set the lazy here, since pojo.proxy can override it.
            model.IsLazy = lazy;

            if (proxyNode != null)
            {
                model.ProxyInterfaceName = ClassForNameChecked(proxyNode.Value, mappings, "proxy class not found: {0}").AssemblyQualifiedName;
                model.IsLazy = true;
            }
            else if (model.IsLazy)
                model.ProxyInterfaceName = model.MappedClass.AssemblyQualifiedName;

            // DISCRIMINATOR
            XmlAttribute discriminatorNode = node.Attributes["discriminator-value"];
            model.DiscriminatorValue = (discriminatorNode == null) ? model.EntityName : discriminatorNode.Value;

            // DYNAMIC UPDATE
            XmlAttribute dynamicNode = node.Attributes["dynamic-update"];
            model.DynamicUpdate = (dynamicNode == null) ? false : "true".Equals(dynamicNode.Value);

            // DYNAMIC INSERT
            XmlAttribute insertNode = node.Attributes["dynamic-insert"];
            model.DynamicInsert = (insertNode == null) ? false : "true".Equals(insertNode.Value);

            // IMPORT

            // we automatically want to add an import of the Assembly Qualified Name (includes version,
            // culture, public-key) to the className supplied in the hbm.xml file.  The most common use-case
            // will have it contain the "FullClassname, AssemblyName", it might contain version, culture,
            // public key, etc...) but should not assume it does.
            mappings.AddImport(model.MappedClass.AssemblyQualifiedName, StringHelper.GetFullClassname(className));

            // if we are supposed to auto-import the Class then add an import to get from the Classname
            // to the Assembly Qualified Class Name
            if (mappings.IsAutoImport)
                mappings.AddImport(model.MappedClass.AssemblyQualifiedName, StringHelper.GetClassname(className));

            // BATCH SIZE
            XmlAttribute batchNode = node.Attributes["batch-size"];
            if (batchNode != null)
                model.BatchSize = int.Parse(batchNode.Value);

            // SELECT BEFORE UPDATE
            XmlAttribute sbuNode = node.Attributes["select-before-update"];
            if (sbuNode != null)
                model.SelectBeforeUpdate = "true".Equals(sbuNode.Value);

            // OPTIMISTIC LOCK MODE
            XmlAttribute olNode = node.Attributes["optimistic-lock"];
            model.OptimisticLockMode = GetOptimisticLockMode(olNode);

            // META ATTRIBUTES
            model.MetaAttributes = GetMetas(node);

            // PERSISTER
            XmlAttribute persisterNode = node.Attributes["persister"];
            if (persisterNode == null)
            {
                //persister = typeof( EntityPersister );
            }
            else
                model.EntityPersisterClass =
                    ClassForNameChecked(persisterNode.Value, mappings, "could not instantiate persister class: {0}");

            // CUSTOM SQL
            HandleCustomSQL(node, model);

            foreach (XmlNode syncNode in node.SelectNodes(HbmConstants.nsSynchronize, namespaceManager))
                model.AddSynchronizedTable(XmlHelper.GetAttributeValue(syncNode, "table"));

            bool? isAbstract = null;
            XmlAttribute abstractNode = node.Attributes["abstract"];
            if (abstractNode != null)
            {
                if ("true".Equals(abstractNode.Value) || "1".Equals(abstractNode.Value))
                    isAbstract = true;
                else if ("false".Equals(abstractNode.Value) || "0".Equals(abstractNode.Value))
                    isAbstract = false;
            }
            model.IsAbstract = isAbstract;
//.........这里部分代码省略.........
开发者ID:aistrate,项目名称:TypingPracticeTexts,代码行数:101,代码来源:ClassBinder.cs

示例2: BindPersistentClassCommonValues

		private void BindPersistentClassCommonValues(IEntityMapping classMapping, PersistentClass model, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			// DISCRIMINATOR
			var discriminable = classMapping as IEntityDiscriminableMapping;
			model.DiscriminatorValue = (discriminable == null || string.IsNullOrEmpty(discriminable.DiscriminatorValue)) ? model.EntityName : discriminable.DiscriminatorValue;

			// DYNAMIC UPDATE
			model.DynamicUpdate = classMapping.DynamicUpdate;

			// DYNAMIC INSERT
			model.DynamicInsert = classMapping.DynamicInsert;

			// IMPORT
			// For entities, the EntityName is the key to find a persister
			// NH Different behavior: we are using the association between EntityName and its more certain implementation (AssemblyQualifiedName)
			// Dynamic entities have no class, reverts to EntityName. -AK
			string qualifiedName = model.MappedClass == null ? model.EntityName : model.MappedClass.AssemblyQualifiedName;
			mappings.AddImport(qualifiedName, model.EntityName);
			if (mappings.IsAutoImport && model.EntityName.IndexOf('.') > 0)
				mappings.AddImport(qualifiedName, StringHelper.Unqualify(model.EntityName));

			// BATCH SIZE
			if (classMapping.BatchSize.HasValue)
				model.BatchSize = classMapping.BatchSize.Value;

			// SELECT BEFORE UPDATE
			model.SelectBeforeUpdate = classMapping.SelectBeforeUpdate;

			// META ATTRIBUTES
			model.MetaAttributes = GetMetas(classMapping, inheritedMetas);

			// PERSISTER
			if(!string.IsNullOrEmpty(classMapping.Persister))
				model.EntityPersisterClass = ClassForNameChecked(classMapping.Persister, mappings,
				                                                 "could not instantiate persister class: {0}");

			// CUSTOM SQL
			HandleCustomSQL(classMapping, model);
			if (classMapping.SqlLoader != null)
				model.LoaderName = classMapping.SqlLoader.queryref;

			foreach (var synchronize in classMapping.Synchronize)
			{
				model.AddSynchronizedTable(synchronize.table);
			}

			model.IsAbstract = classMapping.IsAbstract;
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:48,代码来源:ClassBinder.cs

示例3: BindPersistentClassCommonValues

		private void BindPersistentClassCommonValues(XmlNode node, IDecoratable classMapping, PersistentClass model, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			// DISCRIMINATOR
			XmlAttribute discriminatorNode = node.Attributes["discriminator-value"];
			model.DiscriminatorValue = (discriminatorNode == null) ? model.EntityName : discriminatorNode.Value;

			// DYNAMIC UPDATE
			XmlAttribute dynamicNode = node.Attributes["dynamic-update"];
			model.DynamicUpdate = (dynamicNode == null) ? false : "true".Equals(dynamicNode.Value);

			// DYNAMIC INSERT
			XmlAttribute insertNode = node.Attributes["dynamic-insert"];
			model.DynamicInsert = (insertNode == null) ? false : "true".Equals(insertNode.Value);

			// IMPORT
			// For entities, the EntityName is the key to find a persister
			// NH Different behavior: we are using the association between EntityName and its more certain implementation (AssemblyQualifiedName)
			// Dynamic entities have no class, reverts to EntityName. -AK
			string qualifiedName = model.MappedClass == null ? model.EntityName : model.MappedClass.AssemblyQualifiedName;
			mappings.AddImport(qualifiedName, model.EntityName);
			if (mappings.IsAutoImport && model.EntityName.IndexOf('.') > 0)
				mappings.AddImport(qualifiedName, StringHelper.Unqualify(model.EntityName));

			// BATCH SIZE
			XmlAttribute batchNode = node.Attributes["batch-size"];
			if (batchNode != null)
				model.BatchSize = int.Parse(batchNode.Value);

			// SELECT BEFORE UPDATE
			XmlAttribute sbuNode = node.Attributes["select-before-update"];
			if (sbuNode != null)
				model.SelectBeforeUpdate = "true".Equals(sbuNode.Value);

			// OPTIMISTIC LOCK MODE
			XmlAttribute olNode = node.Attributes["optimistic-lock"];
			model.OptimisticLockMode = GetOptimisticLockMode(olNode);

			// META ATTRIBUTES
			model.MetaAttributes = classMapping != null
			                       	? GetMetas(classMapping, inheritedMetas)
			                       	: GetMetas(node.SelectNodes(HbmConstants.nsMeta, namespaceManager), inheritedMetas);

			// PERSISTER
			XmlAttribute persisterNode = node.Attributes["persister"];
			if (persisterNode == null)
			{
				//persister = typeof( EntityPersister );
			}
			else
				model.EntityPersisterClass = ClassForNameChecked(persisterNode.Value, mappings,
				                                                 "could not instantiate persister class: {0}");

			// CUSTOM SQL
			HandleCustomSQL(node, model);

			foreach (XmlNode syncNode in node.SelectNodes(HbmConstants.nsSynchronize, namespaceManager))
				model.AddSynchronizedTable(XmlHelper.GetAttributeValue(syncNode, "table"));

			bool? isAbstract = null;
			XmlAttribute abstractNode = node.Attributes["abstract"];
			if (abstractNode != null)
			{
				if ("true".Equals(abstractNode.Value) || "1".Equals(abstractNode.Value))
					isAbstract = true;
				else if ("false".Equals(abstractNode.Value) || "0".Equals(abstractNode.Value))
					isAbstract = false;
			}
			model.IsAbstract = isAbstract;
		}
开发者ID:nkmajeti,项目名称:nhibernate,代码行数:69,代码来源:ClassBinder.cs


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