本文整理汇总了C#中IClassMapper.Cache方法的典型用法代码示例。如果您正苦于以下问题:C# IClassMapper.Cache方法的具体用法?C# IClassMapper.Cache怎么用?C# IClassMapper.Cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IClassMapper
的用法示例。
在下文中一共展示了IClassMapper.Cache方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileSystemItemCustomization
void FileSystemItemCustomization(IClassMapper<FileSystemItem> ca)
{
ca.Table(tablePrefix + "FSItem");
ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
ca.Lazy(false);
ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); });
ca.Component(x => x.Path, cm =>
{
cm.Property(x => x.Parent, ccm => { ccm.Length(1024); });
cm.Property(x => x.Name, ccm => { ccm.Length(255); });
cm.Property(x => x.IsDirectory, ccm => { });
});
ca.Property(x => x.Created, cm => { cm.NotNullable(true); });
ca.Property(x => x.Updated, cm => { cm.NotNullable(true); });
ca.Property(x => x.Length, cm => { });
//ca.Bag(x => x.Chunks, cm =>
// {
// cm.Key(k => k.Column("FileID"));
// cm.Inverse(true);
// cm.Cascade(Cascade.All);
// cm.OrderBy(ci => ci.Offset);
// cm.Lazy(CollectionLazy.Extra);
// }, cr => cr.OneToMany());
}
示例2: ContentVersionCustomization
void ContentVersionCustomization(IClassMapper<ContentVersion> ca)
{
ca.Table(tablePrefix + "Version");
ca.Lazy(false);
ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); cm.Region(cacheRegion); });
ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
ca.Component(x => x.Master, cm => { cm.Property(cr => cr.ID, pm => pm.Column("MasterID")); });
ca.Property(x => x.Title, xm => { });
ca.Property(x => x.Published, cm => { });
ca.Property(x => x.FuturePublish, cm => { });
ca.Property(x => x.Expired, cm => { });
ca.Property(x => x.VersionIndex, cm => { });
ca.Property(x => x.Saved, cm => { });
ca.Property(x => x.State, cm => { });
ca.Property(x => x.SavedBy, cm => { });
ca.Property(x => x.ItemCount, cm => { });
ca.Property(x => x.VersionDataXml, cm => { cm.Type(NHibernateUtil.StringClob); cm.Length(stringLength); });
}
示例3: AuthorizedRoleCustomization
void AuthorizedRoleCustomization(IClassMapper<AuthorizedRole> ca)
{
ca.Table(tablePrefix + "AllowedRole");
ca.Lazy(false);
ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); cm.Region(cacheRegion); });
ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
ca.ManyToOne(x => x.EnclosingItem, cm => { cm.Column("ItemID"); cm.NotNullable(true); });
ca.Property(x => x.Role, cm => { cm.Length(50); cm.NotNullable(true); });
}
示例4: DetailCollectionCustomization
void DetailCollectionCustomization(IClassMapper<DetailCollection> ca)
{
ca.Table(tablePrefix + "DetailCollection");
ca.Lazy(false);
ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); cm.Region(cacheRegion); });
ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
ca.ManyToOne(x => x.EnclosingItem, cm => { cm.Column("ItemID"); cm.Fetch(FetchKind.Select); cm.Lazy(LazyRelation.Proxy); });
ca.Property(x => x.Name, cm => { cm.Length(50); cm.NotNullable(true); });
ca.Bag(x => x.Details, cm =>
{
cm.Key(k => k.Column("DetailCollectionID"));
cm.Inverse(true);
cm.Cascade(Cascade.All | Cascade.DeleteOrphans);
cm.Lazy(CollectionLazy.Lazy);
cm.Fetch(CollectionFetchMode.Select);
cm.Cache(m => { m.Usage(CacheUsage.NonstrictReadWrite); m.Region(cacheRegion); });
}, cr => cr.OneToMany());
}
示例5: ContentDetailCustomization
void ContentDetailCustomization(IClassMapper<ContentDetail> ca)
{
ca.Table(tablePrefix + "Detail");
ca.Lazy(false);
ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); cm.Region(cacheRegion); });
ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
ca.ManyToOne(x => x.EnclosingItem, cm => { cm.Column("ItemID"); cm.NotNullable(true); cm.Fetch(FetchKind.Select); cm.Lazy(LazyRelation.Proxy); });
ca.ManyToOne(x => x.EnclosingCollection, cm => { cm.Column("DetailCollectionID"); cm.Fetch(FetchKind.Select); cm.Lazy(LazyRelation.Proxy); });
ca.Property(x => x.ValueTypeKey, cm => { cm.Column("Type"); cm.Length(10); });
ca.Property(x => x.Name, cm => { cm.Length(50); });
ca.Property(x => x.Meta, cm => { cm.Type(NHibernateUtil.StringClob); cm.Length(stringLength); });
ca.Property(x => x.BoolValue, cm => { });
ca.Property(x => x.DateTimeValue, cm => { });
ca.Property(x => x.IntValue, cm => { });
ca.Component(x => x.LinkedItem, cm =>
{
cm.Property(cr => cr.ID, pm => pm.Column("LinkValue"));
});
//ca.ManyToOne(x => x.LinkedItem, cm => { cm.Column("LinkValue"); cm.NotFound(NotFoundMode.Ignore); cm.Fetch(FetchKind.Select); cm.Lazy(LazyRelation.Proxy); cm.Cascade(Cascade.None); });
ca.Property(x => x.DoubleValue, cm => { });
// if you are using Oracle10g and get
// ORA-01461: can bind a LONG value only for insert into a LONG column
// use the following line instead of the the later one (NOTICE both apply to the same property)
// ca.Property(x => x.StringValue, cm => { cm.Type(NHibernateUtil.AnsiString); cm.Length(stringLength); });
ca.Property(x => x.StringValue, cm => { cm.Type(NHibernateUtil.StringClob); cm.Length(stringLength); });
ca.Property(x => x.ObjectValue, cm => { cm.Column("Value"); cm.Type(NHibernateUtil.Serializable); cm.Length(ConfigurationBuilder.BlobLength); });
}
示例6: 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());
}
示例7: ContentDetailCustomization
void ContentDetailCustomization(IClassMapper<ContentDetail> ca)
{
ca.Table(tablePrefix + "Detail");
ca.Lazy(false);
ca.Cache(cm => { cm.Usage(CacheUsage.NonstrictReadWrite); });
ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
ca.ManyToOne(x => x.EnclosingItem, cm => { cm.Column("ItemID"); cm.NotNullable(true); cm.Fetch(FetchKind.Select); });
ca.ManyToOne(x => x.EnclosingCollection, cm => { cm.Column("DetailCollectionID"); cm.Fetch(FetchKind.Select); cm.Lazy(LazyRelation.Proxy); });
ca.Property(x => x.ValueTypeKey, cm => { cm.Column("Type"); cm.Length(10); });
ca.Property(x => x.Name, cm => { cm.Length(50); });
ca.Property(x => x.BoolValue, cm => { });
ca.Property(x => x.DateTimeValue, cm => { });
ca.Property(x => x.IntValue, cm => { });
ca.ManyToOne(x => x.LinkedItem, cm => { cm.Column("LinkValue"); cm.Lazy(LazyRelation.Proxy); cm.Cascade(Cascade.None); });
ca.Property(x => x.DoubleValue, cm => { });
ca.Property(x => x.StringValue, cm => { cm.Type(NHibernateUtil.StringClob); cm.Length(stringLength); });
ca.Property(x => x.ObjectValue, cm => { cm.Column("Value"); cm.Type(NHibernateUtil.Serializable); cm.Length(2147483647); });
}