Exemplo n.º 1
0
        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());
        }
        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());
        }
Exemplo n.º 3
0
 void FileSystemChunkCustomization(IClassMapper <FileSystemChunk> ca)
 {
     ca.Table(tablePrefix + "FSChunk");
     ca.Lazy(false);
     ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
     ca.ManyToOne(x => x.BelongsTo, m => { m.Column("FileID"); });
     ca.Property(x => x.Offset, cm => { });
     ca.Property(cm => cm.Data, cm => { cm.Type(NHibernateUtil.BinaryBlob); cm.Length(ConfigurationBuilder.BlobLength); cm.Lazy(false); });
 }
		private void BucketCustomization(IClassMapper<Bucket> ca)
		{
			ca.Table(tablePrefix + "StatisticsBucket");
			ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
			ca.Lazy(false);
			ca.Property(x => x.PageID, cm => { cm.NotNullable(true); });
			ca.Property(x => x.TimeSlot, cm => { cm.NotNullable(true); });
			ca.Property(x => x.Views, cm => { cm.NotNullable(true); });
		}
 private void BucketCustomization(IClassMapper <Bucket> ca)
 {
     ca.Table(tablePrefix + "StatisticsBucket");
     ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
     ca.Lazy(false);
     ca.Property(x => x.PageID, cm => { cm.NotNullable(true); });
     ca.Property(x => x.TimeSlot, cm => { cm.NotNullable(true); });
     ca.Property(x => x.Views, cm => { cm.NotNullable(true); });
 }
 void FileSystemChunkCustomization(IClassMapper<FileSystemChunk> ca)
 {
     ca.Table(tablePrefix + "FSChunk");
     ca.Lazy(false);
     ca.Id(x => x.ID, cm => { cm.Generator(Generators.Native); });
     ca.ManyToOne(x => x.BelongsTo, m => { m.Column("FileID"); });
     ca.Property(x => x.Offset, cm => { });
     ca.Property(cm => cm.Data, cm => { cm.Type(NHibernateUtil.BinaryBlob); cm.Length(ConfigurationBuilder.BlobLength); cm.Lazy(false); });
 }
Exemplo n.º 7
0
 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); });
 }
 private void StatisticCustomization(IClassMapper <Statistic> ca)
 {
     ca.Table(tablePrefix + "Statistics");
     ca.ComposedId(x =>
     {
         x.Property(y => y.TimeSlot);
         x.Property(y => y.PageID);
     });
     //ca.Id(x => new { x.TimeSlot, x.PageID }, cm => { cm.Generator(Generators.Assigned); });
     ca.Lazy(false);
     ca.Property(x => x.TimeSlot, cm => { cm.NotNullable(true); });
     ca.Property(x => x.Views, cm => { cm.NotNullable(true); });
 }
		private void StatisticCustomization(IClassMapper<Statistic> ca)
		{
			ca.Table(tablePrefix + "Statistics");
			ca.ComposedId(x =>
			{
				x.Property(y => y.TimeSlot);
				x.Property(y => y.PageID);
			});
			//ca.Id(x => new { x.TimeSlot, x.PageID }, cm => { cm.Generator(Generators.Assigned); });
			ca.Lazy(false);
			ca.Property(x => x.TimeSlot, cm => { cm.NotNullable(true); });
			ca.Property(x => x.Views, cm => { cm.NotNullable(true); });
		}
Exemplo n.º 10
0
 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); });
 }
 public static void CompositeEventProperty <T>(this IClassMapper <T> mapper,
                                               Expression <Func <T, CompositeEventStatus> > compositeEventStatusExpression)
     where T : class
 {
     mapper.Property(compositeEventStatusExpression, x =>
     {
         x.Type <CompositeEventStatusUserType>();
         x.NotNullable(true);
     });
 }
Exemplo n.º 12
0
        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(GetStringClobType()); cm.Length(stringLength); });
        }
 public static void StateProperty <T, TMachine>(this IClassMapper <T> mapper,
                                                Expression <Func <T, State> > stateExpression)
     where T : class
     where TMachine : StateMachine, new()
 {
     mapper.Property(stateExpression, x =>
     {
         x.Type <AutomatonymousStateUserType <TMachine> >();
         x.NotNullable(true);
         x.Length(80);
     });
 }
Exemplo n.º 14
0
        public static void StateProperty <T>(this IClassMapper <T> mapper,
                                             Expression <Func <T, State> > stateExpression, Action <IPropertyMapper> callback)
            where T : class
        {
            mapper.Property(stateExpression, x =>
            {
                x.Access(Accessor.Field);
                x.Type <StateMachineUserType>();
                x.NotNullable(true);

                callback(x);
            });
        }
Exemplo n.º 15
0
        public static void StateProperty <T>(this IClassMapper <T> mapper,
                                             Expression <Func <T, State> > stateExpression, int length)
            where T : class
        {
            mapper.Property(stateExpression, x =>
            {
                x.Access(Accessor.Field);
                x.Type <StateMachineUserType>();
                x.NotNullable(true);

                x.Length(length);
            });
        }
Exemplo n.º 16
0
 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); });
 }
Exemplo n.º 17
0
 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(GetStringClobType()); 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 => { });
     ca.Property(x => x.StringValue, cm => { cm.Type(GetStringClobType()); cm.Length(stringLength); });
     ca.Property(x => x.ObjectValue, cm => { cm.Column("Value"); cm.Type(NHibernateUtil.Serializable); cm.Length(ConfigurationBuilder.BlobLength); });
 }
Exemplo n.º 18
0
 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());
 }
        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); });
        }
		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); });
		}
		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());
		}
		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); });
		}
		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());
		}
Exemplo n.º 24
0
 /// <summary>
 /// 代理执行Propert
 /// </summary>
 /// <typeparam name="X">Entity类型泛型</typeparam>
 /// <typeparam name="T">参数类型泛型</typeparam>
 /// <param name="inputValue">输入的Mapper</param>
 /// <param name="inputProperty">输入的表达式参数</param>
 private static void Property <X, T>(IClassMapper <X> inputValue, Expression <Func <X, T> > inputProperty)
     where X : BaseEntity
 {
     inputValue.Property <T>(inputProperty);
 }
Exemplo n.º 25
0
        void FileSystemItemCustomization(IClassMapper<FileSystemItem> ca)
        {
            ca.Table(tablePrefix + "FileSystemItem");
            ca.Id(x => x.ID, cm => {cm.Generator(Generators.Native);});

            ca.Component(x => x.Path, cm =>
                                           {
                                               cm.Property( x => x.Parent, ccm => {ccm.Length(1024);});
                                               cm.Property( x => x.Name, ccm => { ccm.Length(255);});
                                           } );
            ca.Property( x => x.Created, cm => {cm.NotNullable(true);});
            ca.Property( x => x.Length, cm => {} );
            ca.Property( cm => cm.Data, cm => {cm.Type(NHibernateUtil.BinaryBlob); cm.Length(2147483647); cm.Lazy(true);});
        }
Exemplo n.º 26
0
 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 <DetailCollectionFactory>();
         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());
 }
Exemplo n.º 27
0
 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); });
 }