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


C# IClassMapper.Discriminator方法代码示例

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


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

示例1: ContentItemCustomization

		void ContentItemCustomization(IClassMapper<ContentItem> ca)
		{
			ca.Table(tablePrefix + "Item");
			ca.Lazy(false);
			ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); cm.Region(cacheRegion); });
			ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
			ca.Discriminator(cm => { cm.Column("Type"); cm.Type(NHibernateUtil.String); });
			ca.Property(x => x.Created, cm => { });
			ca.Property(x => x.Published, cm => { });
			ca.Property(x => x.Updated, cm => { });
			ca.Property(x => x.Expires, cm => { });
			ca.Property(x => x.Name, cm => { cm.Length(250); });
			ca.Property(x => x.ZoneName, cm => { cm.Length(50); });
			ca.Property(x => x.TemplateKey, cm => { cm.Length(50); });
			ca.Property(x => x.TranslationKey, cm => { });
			ca.Property(x => x.Title, cm => { cm.Length(250); });
			ca.Property(x => x.SortOrder, cm => { });
			ca.Property(x => x.Visible, cm => { });
			ca.Property(x => x.SavedBy, cm => { cm.Length(50); });
			ca.Property(x => x.State, cm => { });
			ca.Property(x => x.ChildState, cm => { });
			ca.Property(x => x.AncestralTrail, cm => { cm.Length(100); });
			ca.Property(x => x.VersionIndex, cm => { });
			ca.Property(x => x.AlteredPermissions, cm => { });
			//ca.ManyToOne(x => x.VersionOf, cm => { cm.Column("VersionOfID"); cm.Lazy(LazyRelation.Proxy); cm.Fetch(FetchKind.Select); });
			//ca.Property(x => x.VersionOf, cm =>
			//{
			//    cm.Column("VersionOfID");
			//    cm.Type<ContentRelationFactory>();
			//});
			ca.Component(x => x.VersionOf, cm =>
			{
				cm.Property(cr => cr.ID, pm => pm.Column("VersionOfID"));
			});
			ca.ManyToOne(x => x.Parent, cm => { cm.Column("ParentID"); cm.Lazy(LazyRelation.Proxy); cm.Fetch(FetchKind.Select); });
			ca.Bag(x => x.Children, cm =>
			{
				cm.Key(k => k.Column("ParentID"));
				cm.Inverse(true);
				cm.Type<ContentItemListFactory<ContentItem>>();
				cm.Cascade(childrenCascade);
				cm.OrderBy(ci => ci.SortOrder);
				cm.Lazy(childrenLaziness);
				if (childrenBatch)
					cm.BatchSize(batchSize ?? 10);
				cm.Cache(m => { m.Usage(CacheUsage.NonstrictReadWrite); m.Region(cacheRegion); });
			}, cr => cr.OneToMany());
			ca.Bag(x => x.Details, cm =>
			{
				cm.Key(k => k.Column("ItemID"));
				cm.Inverse(true);
				cm.Type<ContentListFactory<ContentDetail>>();
				cm.Cascade(Cascade.All | Cascade.DeleteOrphans);
				cm.Fetch(CollectionFetchMode.Select);
				cm.Lazy(CollectionLazy.Lazy);
				cm.BatchSize(batchSize ?? 10);
				cm.Cache(m => { m.Usage(CacheUsage.NonstrictReadWrite); m.Region(cacheRegion); });
				cm.Where("DetailCollectionID IS NULL");
			}, cr => cr.OneToMany());
			ca.Bag(x => x.DetailCollections, cm =>
			{
				cm.Key(k => k.Column("ItemID"));
				cm.Inverse(true);
				cm.Type<ContentListFactory<DetailCollection>>();
				cm.Cascade(Cascade.All | Cascade.DeleteOrphans);
				cm.Fetch(CollectionFetchMode.Select);
				cm.Lazy(CollectionLazy.Lazy);
				cm.BatchSize(batchSize ?? 10);
				cm.Cache(m => { m.Usage(CacheUsage.NonstrictReadWrite); m.Region(cacheRegion); });
			}, cr => cr.OneToMany());
			ca.Bag(x => x.AuthorizedRoles, cm =>
			{
				cm.Key(k => k.Column("ItemID"));
				cm.Inverse(true);
				cm.Cascade(Cascade.All | Cascade.DeleteOrphans);
				cm.Fetch(CollectionFetchMode.Select);
				cm.Lazy(CollectionLazy.Lazy);
				cm.BatchSize(batchSize ?? 25);
				cm.Cache(m => { m.Usage(CacheUsage.NonstrictReadWrite); m.Region(cacheRegion); });
			}, cr => cr.OneToMany());
		}
开发者ID:nagarjunachallapalli,项目名称:n2cms,代码行数:81,代码来源:ConfigurationBuilder.cs


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