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


C# CollectionType.GetElementType方法代码示例

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


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

示例1: GetElementType

		/// <summary>
		/// Given a collection type, determine the Type representing elements
		/// within instances of that collection.
		/// </summary>
		/// <param name="collectionType">The collection type to be checked.</param>
		/// <returns>The Type of the elements of the collection.</returns>
		private IType GetElementType(CollectionType collectionType)
		{
			return collectionType.GetElementType(_sfi);
		}
开发者ID:KaraokeStu,项目名称:nhibernate-core,代码行数:10,代码来源:SessionFactoryHelperExtensions.cs

示例2: CascadeCollectionElements

		/// <summary> Cascade to the collection elements</summary>
		private void CascadeCollectionElements(object child, CollectionType collectionType, CascadeStyle style, IType elemType, object anything, bool isCascadeDeleteEnabled)
		{
			// we can't cascade to non-embedded elements
			bool embeddedElements = eventSource.EntityMode != EntityMode.Xml
			                        || ((EntityType) collectionType.GetElementType(eventSource.Factory)).IsEmbeddedInXML;

			bool reallyDoCascade = style.ReallyDoCascade(action) && embeddedElements
			                       && child != CollectionType.UnfetchedCollection;

			if (reallyDoCascade)
			{
				log.Info("cascade " + action + " for collection: " + collectionType.Role);

				foreach (object o in action.GetCascadableChildrenIterator(eventSource, collectionType, child))
					CascadeProperty(o, elemType, style, anything, isCascadeDeleteEnabled);

				log.Info("done cascade " + action + " for collection: " + collectionType.Role);
			}

			var childAsPersColl = child as IPersistentCollection;
			bool deleteOrphans = style.HasOrphanDelete && action.DeleteOrphans && elemType.IsEntityType
			                     && childAsPersColl != null; //a newly instantiated collection can't have orphans

			if (deleteOrphans)
			{
				// handle orphaned entities!!
				log.Info("deleting orphans for collection: " + collectionType.Role);

				// we can do the cast since orphan-delete does not apply to:
				// 1. newly instantiated collections
				// 2. arrays (we can't track orphans for detached arrays)
				string entityName = collectionType.GetAssociatedEntityName(eventSource.Factory);
				DeleteOrphans(entityName, childAsPersColl);

				log.Info("done deleting orphans for collection: " + collectionType.Role);
			}
		}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:38,代码来源:Cascade.cs


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