예제 #1
0
        public void Configure(EntityTypeBuilder <PageDirectoryLocale> builder)
        {
            builder.ToTable("PageDirectoryLocale", DbConstants.CofoundrySchema);

            // Primary Key

            builder.HasKey(s => s.PageDirectoryLocaleId);

            // Properties
            builder.Property(s => s.UrlPath)
            .IsRequired()
            .HasMaxLength(64);

            // Relationships

            builder.HasOne(s => s.Locale)
            .WithMany()
            .HasForeignKey(d => d.LocaleId);

            builder.HasOne(s => s.PageDirectory)
            .WithMany(s => s.PageDirectoryLocales)
            .HasForeignKey(d => d.PageDirectoryId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #2
0
        public void Configure(EntityTypeBuilder <PageTag> builder)
        {
            builder.ToTable("PageTag", DbConstants.CofoundrySchema);

            // Primary Key

            builder.HasKey(s => new { s.PageId, s.TagId });

            // Properties

            builder.Property(s => s.PageId)
            .ValueGeneratedNever();

            builder.Property(s => s.TagId)
            .ValueGeneratedNever();

            // Relationships

            builder.HasOne(s => s.Page)
            .WithMany(s => s.PageTags)
            .HasForeignKey(d => d.PageId);

            builder.HasOne(s => s.Tag)
            .WithMany()
            .HasForeignKey(d => d.TagId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #3
0
        public void Configure(EntityTypeBuilder <PageVersion> builder)
        {
            builder.ToTable("PageVersion", DbConstants.CofoundrySchema);

            // Properties

            builder.Property(s => s.Title)
            .IsRequired()
            .HasMaxLength(300);

            builder.Property(s => s.MetaDescription)
            .IsRequired()
            .HasMaxLength(300);

            builder.Property(s => s.OpenGraphTitle)
            .HasMaxLength(300);

            // Relationships

            builder.HasOne(s => s.OpenGraphImageAsset)
            .WithMany()
            .HasForeignKey(d => d.OpenGraphImageId);

            builder.HasOne(s => s.PageTemplate)
            .WithMany(s => s.PageVersions)
            .HasForeignKey(d => d.PageTemplateId);

            builder.HasOne(s => s.Page)
            .WithMany(s => s.PageVersions)
            .HasForeignKey(d => d.PageId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #4
0
        public PageVersionMap()
        {
            // Properties
            Property(t => t.Title)
            .IsRequired()
            .HasMaxLength(300);

            Property(t => t.MetaDescription)
            .IsRequired()
            .HasMaxLength(300);

            Property(t => t.OpenGraphTitle)
            .HasMaxLength(300);

            // Relationships
            HasOptional(t => t.OpenGraphImageAsset)
            .WithMany()
            .HasForeignKey(d => d.OpenGraphImageId);
            HasRequired(t => t.PageTemplate)
            .WithMany(t => t.PageVersions)
            .HasForeignKey(d => d.PageTemplateId);
            HasRequired(t => t.Page)
            .WithMany(t => t.PageVersions)
            .HasForeignKey(d => d.PageId);
            HasOptional(t => t.BasedOnPageVersion)
            .WithMany(t => t.ChildPageVersions)
            .HasForeignKey(d => d.BasedOnPageVersionId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #5
0
        public void Configure(EntityTypeBuilder <CustomEntity> builder)
        {
            builder.ToTable("CustomEntity", DbConstants.CofoundrySchema);

            // Properties

            builder.Property(s => s.CustomEntityDefinitionCode)
            .IsRequired()
            .IsCharType(6);

            builder.Property(s => s.UrlSlug)
            .HasMaxLength(200)
            .IsRequired();

            builder.Property(s => s.PublishStatusCode)
            .HasMaxLength(1)
            .IsUnicode(false);

            // Relationships

            builder.HasOne(s => s.CustomEntityDefinition)
            .WithMany()
            .HasForeignKey(d => d.CustomEntityDefinitionCode);

            builder.HasOne(s => s.Locale)
            .WithMany()
            .HasForeignKey(d => d.LocaleId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #6
0
        public void Configure(EntityTypeBuilder <PageVersionBlock> builder)
        {
            builder.ToTable("PageVersionBlock", DbConstants.CofoundrySchema);

            // Properties

            builder.Property(s => s.SerializedData)
            .IsRequired()
            .IsNVarCharMaxType();

            // Relationships

            builder.HasOne(s => s.PageTemplateRegion)
            .WithMany(s => s.PageVersionBlockss)
            .HasForeignKey(d => d.PageTemplateRegionId);

            builder.HasOne(s => s.PageBlockType)
            .WithMany(s => s.PageVersionBlocks)
            .HasForeignKey(d => d.PageBlockTypeId);

            builder.HasOne(s => s.PageVersion)
            .WithMany(s => s.PageVersionBlocks)
            .HasForeignKey(d => d.PageVersionId);

            builder.HasOne(s => s.PageBlockTypeTemplate)
            .WithMany()
            .HasForeignKey(s => s.PageBlockTypeTemplateId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #7
0
        public ImageAssetTagMap()
        {
            ToTable("ImageAssetTag", DbConstants.CofoundrySchema);

            // Primary Key
            HasKey(t => new { t.ImageAssetId, t.TagId });

            // Properties
            Property(t => t.ImageAssetId)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            Property(t => t.TagId)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);


            // Relationships
            HasRequired(t => t.ImageAsset)
            .WithMany(t => t.ImageAssetTags)
            .HasForeignKey(d => d.ImageAssetId);
            HasRequired(t => t.Tag)
            .WithMany()
            .HasForeignKey(d => d.TagId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #8
0
        public void Configure(EntityTypeBuilder <DocumentAssetTag> builder)
        {
            builder.ToTable("DocumentAssetTag", DbConstants.CofoundrySchema);

            // Primary Key
            builder.HasKey(s => new { s.DocumentAssetId, s.TagId });

            // Properties
            builder.Property(s => s.DocumentAssetId)
            .ValueGeneratedNever();

            builder.Property(s => s.TagId)
            .ValueGeneratedNever();

            // Relationships
            builder.HasOne(s => s.DocumentAsset)
            .WithMany(s => s.DocumentAssetTags)
            .HasForeignKey(d => d.DocumentAssetId);

            builder.HasOne(s => s.Tag)
            .WithMany()
            .HasForeignKey(d => d.TagId)
            .OnDelete(DeleteBehavior.Restrict);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #9
0
        public void Configure(EntityTypeBuilder <PageDirectory> builder)
        {
            builder.ToTable(nameof(PageDirectory), DbConstants.CofoundrySchema);
            builder.HasKey(s => s.PageDirectoryId);

            builder.Property(s => s.Name)
            .HasMaxLength(200);

            builder.Property(s => s.UrlPath)
            .IsRequired()
            .HasMaxLength(200);

            builder.HasOne(s => s.ParentPageDirectory)
            .WithMany(d => d.ChildPageDirectories)
            .HasForeignKey(s => s.ParentPageDirectoryId);

            builder.HasOne(s => s.UserAreaForSignInRedirect)
            .WithMany()
            .HasForeignKey(s => s.UserAreaCodeForSignInRedirect);

            builder.HasOne(s => s.PageDirectoryPath)
            .WithOne(d => d.PageDirectory)
            .HasForeignKey <PageDirectoryPath>(s => s.PageDirectoryId);

            CreateAuditableMappingHelper.Map(builder);
        }
        public void Configure(EntityTypeBuilder <PageDirectoryAccessRule> builder)
        {
            builder.ToTable(nameof(PageDirectoryAccessRule), DbConstants.CofoundrySchema);

            builder.Property(s => s.UserAreaCode)
            .IsRequired()
            .IsCharType(3);

            builder
            .HasOne(s => s.Creator)
            .WithMany()
            .HasForeignKey(s => s.CreatorId);

            builder
            .HasOne(s => s.PageDirectory)
            .WithMany(d => d.AccessRules)
            .HasForeignKey(s => s.PageDirectoryId);

            builder
            .HasOne(s => s.Role)
            .WithMany(d => d.PageDirectoryAccessRules)
            .HasForeignKey(s => s.RoleId);

            builder
            .HasOne(s => s.UserArea)
            .WithMany(d => d.PageDirectoryAccessRules)
            .HasForeignKey(s => s.UserAreaCode);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #11
0
        public void Configure(EntityTypeBuilder <ImageAssetGroupItem> builder)
        {
            builder.ToTable("ImageAssetGroupItem", DbConstants.CofoundrySchema);

            // Primary Key
            builder.HasKey(s => new { s.ImageAssetId, s.ImageAssetGroupId });

            // Properties
            builder.Property(s => s.ImageAssetId)
            .ValueGeneratedNever();

            builder.Property(s => s.ImageAssetGroupId)
            .ValueGeneratedNever();

            // Relationships
            builder.HasOne(s => s.ImageAssetGroup)
            .WithMany(s => s.ImageAssetGroupItems)
            .HasForeignKey(d => d.ImageAssetGroupId);

            builder.HasOne(s => s.ImageAsset)
            .WithMany(s => s.ImageAssetGroupItems)
            .HasForeignKey(d => d.ImageAssetId);

            CreateAuditableMappingHelper.Map(builder);
        }
        public static void Map <T>(EntityTypeConfiguration <T> entity) where T : class, IUpdateAuditable
        {
            CreateAuditableMappingHelper.Map(entity);

            // Relationships

            entity.HasRequired(t => t.Updater)
            .WithMany()
            .HasForeignKey(d => d.UpdaterId);
        }
        public static void Map <T>(EntityTypeBuilder <T> builder) where T : class, IUpdateAuditable
        {
            CreateAuditableMappingHelper.Map(builder);

            builder.HasOne(s => s.Updater)
            .WithMany()
            .HasForeignKey(d => d.UpdaterId);

            builder.Property(s => s.UpdateDate).IsUtc();
        }
예제 #14
0
        public static void Map <T>(EntityTypeBuilder <T> builder) where T : class, IUpdateAuditable
        {
            CreateAuditableMappingHelper.Map(builder);

            // Relationships

            builder.HasOne(s => s.Updater)
            .WithMany()
            .HasForeignKey(d => d.UpdaterId);
        }
예제 #15
0
        public RewriteRuleMap()
        {
            // Properties
            Property(t => t.WriteFrom)
            .IsRequired()
            .HasMaxLength(2000);
            Property(t => t.WriteTo)
            .IsRequired()
            .HasMaxLength(2000);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #16
0
        public void Configure(EntityTypeBuilder <RewriteRule> builder)
        {
            builder.ToTable(nameof(RewriteRule), DbConstants.CofoundrySchema);

            builder.Property(s => s.WriteFrom)
            .IsRequired()
            .HasMaxLength(2000);

            builder.Property(s => s.WriteTo)
            .IsRequired()
            .HasMaxLength(2000);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #17
0
        public void Configure(EntityTypeBuilder <PageGroup> builder)
        {
            builder.ToTable(nameof(PageGroup), DbConstants.CofoundrySchema);

            builder.Property(s => s.GroupName)
            .IsRequired()
            .HasMaxLength(64);

            builder.HasOne(s => s.ParentPageGroup)
            .WithMany(s => s.ChildPageGroups)
            .HasForeignKey(d => d.ParentGroupId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #18
0
        public PageGroupMap()
        {
            // Properties
            Property(t => t.GroupName)
            .IsRequired()
            .HasMaxLength(64);

            // Relationships
            HasOptional(t => t.ParentPageGroup)
            .WithMany(t => t.ChildPageGroups)
            .HasForeignKey(d => d.ParentGroupId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #19
0
        public void Configure(EntityTypeBuilder <DocumentAssetGroup> builder)
        {
            builder.ToTable("DocumentAssetGroup", DbConstants.CofoundrySchema);

            // Properties
            builder.Property(s => s.GroupName)
            .IsRequired()
            .HasMaxLength(64);

            // Relationships
            builder.HasOne(s => s.ParentDocumentAssetGroup)
            .WithMany(s => s.ChildDocumentAssetGroups)
            .HasForeignKey(d => d.ParentDocumentAssetGroupId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #20
0
        public DocumentAssetGroupMap()
        {
            ToTable("DocumentAssetGroup", DbConstants.CofoundrySchema);

            // Properties
            Property(t => t.GroupName)
            .IsRequired()
            .HasMaxLength(64);

            // Relationships
            HasOptional(t => t.ParentDocumentAssetGroup)
            .WithMany(t => t.ChildDocumentAssetGroups)
            .HasForeignKey(d => d.ParentDocumentAssetGroupId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #21
0
        public void Configure(EntityTypeBuilder <CustomEntityVersion> builder)
        {
            builder.ToTable(nameof(CustomEntityVersion), DbConstants.CofoundrySchema);

            builder.Property(s => s.SerializedData)
            .IsRequired();

            builder.Property(s => s.Title)
            .HasMaxLength(200)
            .IsRequired();

            builder.HasOne(s => s.CustomEntity)
            .WithMany(s => s.CustomEntityVersions)
            .HasForeignKey(d => d.CustomEntityId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #22
0
        public CustomEntityVersionMap()
        {
            // Properties
            Property(t => t.SerializedData)
            .IsRequired();

            Property(t => t.Title)
            .HasMaxLength(200)
            .IsRequired();

            // Relationships

            HasRequired(t => t.CustomEntity)
            .WithMany(t => t.CustomEntityVersions)
            .HasForeignKey(d => d.CustomEntityId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #23
0
        public WebDirectoryLocaleMap()
        {
            // Primary Key
            HasKey(t => t.WebDirectoryLocaleId);

            // Properties
            Property(t => t.UrlPath)
            .IsRequired()
            .HasMaxLength(64);

            // Relationships
            HasRequired(t => t.Locale)
            .WithMany()
            .HasForeignKey(d => d.LocaleId);
            HasRequired(t => t.WebDirectory)
            .WithMany(t => t.WebDirectoryLocales)
            .HasForeignKey(d => d.WebDirectoryId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #24
0
        public WebDirectoryMap()
        {
            // Primary Key
            HasKey(t => t.WebDirectoryId);

            // Properties
            Property(t => t.Name)
            .IsRequired()
            .HasMaxLength(64);

            Property(t => t.UrlPath)
            .IsRequired()
            .HasMaxLength(64);

            // Relationships
            HasOptional(t => t.ParentWebDirectory)
            .WithMany(t => t.ChildWebDirectories)
            .HasForeignKey(d => d.ParentWebDirectoryId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #25
0
        public void Configure(EntityTypeBuilder <PageGroupItem> builder)
        {
            builder.ToTable(nameof(PageGroupItem), DbConstants.CofoundrySchema);
            builder.HasKey(s => new { s.PageId, s.PageGroupId });

            builder.Property(s => s.PageId)
            .ValueGeneratedNever();

            builder.Property(s => s.PageGroupId)
            .ValueGeneratedNever();

            builder.HasOne(s => s.PageGroup)
            .WithMany(s => s.PageGroupItems)
            .HasForeignKey(d => d.PageGroupId);

            builder.HasOne(s => s.Page)
            .WithMany(s => s.PageGroupItems)
            .HasForeignKey(d => d.PageId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #26
0
        public void Configure(EntityTypeBuilder <ImageAssetTag> builder)
        {
            builder.ToTable(nameof(ImageAssetTag), DbConstants.CofoundrySchema);
            builder.HasKey(s => new { s.ImageAssetId, s.TagId });

            builder.Property(s => s.ImageAssetId)
            .ValueGeneratedNever();

            builder.Property(s => s.TagId)
            .ValueGeneratedNever();

            builder.HasOne(s => s.ImageAsset)
            .WithMany(s => s.ImageAssetTags)
            .HasForeignKey(d => d.ImageAssetId);

            builder.HasOne(s => s.Tag)
            .WithMany()
            .HasForeignKey(d => d.TagId);

            CreateAuditableMappingHelper.Map(builder);
        }
예제 #27
0
        public PageTagMap()
        {
            // Primary Key
            HasKey(t => new { t.PageId, t.TagId });

            // Properties
            Property(t => t.PageId)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            Property(t => t.TagId)
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Relationships
            HasRequired(t => t.Page)
            .WithMany(t => t.PageTags)
            .HasForeignKey(d => d.PageId);
            HasRequired(t => t.Tag)
            .WithMany()
            .HasForeignKey(d => d.TagId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #28
0
        public PageVersionModuleMap()
        {
            // Properties
            Property(t => t.SerializedData)
            .IsRequired();

            // Relationships
            HasRequired(t => t.PageTemplateSection)
            .WithMany(t => t.PageVersionModules)
            .HasForeignKey(d => d.PageTemplateSectionId);
            HasRequired(t => t.PageModuleType)
            .WithMany(t => t.PageVersionModules)
            .HasForeignKey(d => d.PageModuleTypeId);
            HasRequired(t => t.PageVersion)
            .WithMany(t => t.PageVersionModules)
            .HasForeignKey(d => d.PageVersionId);
            HasOptional(t => t.PageModuleTypeTemplate)
            .WithMany()
            .HasForeignKey(t => t.PageModuleTypeTemplateId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #29
0
        public CustomEntityMap()
        {
            // Properties
            Property(t => t.CustomEntityDefinitionCode)
            .HasMaxLength(6)
            .IsFixedLength()
            .IsUnicode(false);

            Property(t => t.UrlSlug)
            .HasMaxLength(200)
            .IsRequired();

            // Relationships
            HasRequired(t => t.CustomEntityDefinition)
            .WithMany()
            .HasForeignKey(d => d.CustomEntityDefinitionCode);

            HasOptional(t => t.Locale)
            .WithMany()
            .HasForeignKey(d => d.LocaleId);

            CreateAuditableMappingHelper.Map(this);
        }
예제 #30
0
        public void Configure(EntityTypeBuilder <Page> builder)
        {
            builder.ToTable(nameof(Page), DbConstants.CofoundrySchema);

            builder.Property(s => s.UrlPath)
            .IsRequired()
            .HasMaxLength(200);

            builder.Property(s => s.CustomEntityDefinitionCode)
            .HasMaxLength(6)
            .IsUnicode(false);

            builder.Property(s => s.PublishStatusCode)
            .HasMaxLength(1)
            .IsUnicode(false);

            builder.HasOne(s => s.Locale)
            .WithMany()
            .HasForeignKey(d => d.LocaleId);

            builder.HasOne(s => s.CustomEntityDefinition)
            .WithMany()
            .HasForeignKey(d => d.CustomEntityDefinitionCode);

            builder.HasOne(s => s.PageDirectory)
            .WithMany(s => s.Pages)
            .HasForeignKey(d => d.PageDirectoryId);

            builder.HasOne(s => s.UserAreaForSignInRedirect)
            .WithMany()
            .HasForeignKey(s => s.UserAreaCodeForSignInRedirect);

            builder.Property(s => s.PublishDate).IsUtc();
            builder.Property(s => s.LastPublishDate).IsUtc();

            CreateAuditableMappingHelper.Map(builder);
        }