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());
        }
Exemplo n.º 2
0
        public static string Table <T>(this IClassMapper <T> map) where T : class
        {
            var tbname = TableName <T>();

            map.Table(tbname);
            return(tbname);
        }
        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.º 4
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 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 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); });
 }
		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); });
		}
Exemplo n.º 9
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 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.º 12
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());
 }
Exemplo n.º 13
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.º 14
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); });
        }
Exemplo n.º 15
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); });
 }
        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.º 21
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.º 22
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.º 23
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); });
 }