Browse Source

Use ConfigureByConvention by the modules

pull/3360/head
Halil İbrahim Kalkan 7 years ago
parent
commit
037c156ad6
  1. 8
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs
  2. 3
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs
  3. 12
      modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs

8
modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs

@ -25,7 +25,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "AuditLogs", options.Schema);
b.ConfigureExtraProperties();
b.ConfigureByConvention();
b.Property(x => x.ApplicationName).HasMaxLength(AuditLogConsts.MaxApplicationNameLength).HasColumnName(nameof(AuditLog.ApplicationName));
b.Property(x => x.ClientIpAddress).HasMaxLength(AuditLogConsts.MaxClientIpAddressLength).HasColumnName(nameof(AuditLog.ClientIpAddress));
@ -56,7 +56,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "AuditLogActions", options.Schema);
b.ConfigureExtraProperties();
b.ConfigureByConvention();
b.Property(x => x.AuditLogId).HasColumnName(nameof(AuditLogAction.AuditLogId));
b.Property(x => x.ServiceName).HasMaxLength(AuditLogActionConsts.MaxServiceNameLength).HasColumnName(nameof(AuditLogAction.ServiceName));
@ -73,7 +73,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "EntityChanges", options.Schema);
b.ConfigureExtraProperties();
b.ConfigureByConvention();
b.Property(x => x.EntityTypeFullName).HasMaxLength(EntityChangeConsts.MaxEntityTypeFullNameLength).IsRequired().HasColumnName(nameof(EntityChange.EntityTypeFullName));
b.Property(x => x.EntityId).HasMaxLength(EntityChangeConsts.MaxEntityIdLength).IsRequired().HasColumnName(nameof(EntityChange.EntityId));
@ -92,6 +92,8 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "EntityPropertyChanges", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.NewValue).HasMaxLength(EntityPropertyChangeConsts.MaxNewValueLength).HasColumnName(nameof(EntityPropertyChange.NewValue));
b.Property(x => x.PropertyName).HasMaxLength(EntityPropertyChangeConsts.MaxPropertyNameLength).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyName));
b.Property(x => x.PropertyTypeFullName).HasMaxLength(EntityPropertyChangeConsts.MaxPropertyTypeFullNameLength).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyTypeFullName));

3
modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs

@ -23,8 +23,7 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "BackgroundJobs", options.Schema);
b.ConfigureCreationTime();
b.ConfigureExtraProperties();
b.ConfigureByConvention();
b.Property(x => x.JobName).IsRequired().HasMaxLength(BackgroundJobRecordConsts.MaxJobNameLength);
b.Property(x => x.JobArgs).IsRequired().HasMaxLength(BackgroundJobRecordConsts.MaxJobArgsLength);

12
modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs

@ -31,15 +31,15 @@ namespace Volo.Blogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "Users", options.Schema);
b.ConfigureByConvention();
b.ConfigureAbpUser();
b.ConfigureExtraProperties();
});
builder.Entity<Blog>(b =>
{
b.ToTable(options.TablePrefix + "Blogs", options.Schema);
b.ConfigureFullAuditedAggregateRoot();
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(BlogConsts.MaxNameLength).HasColumnName(nameof(Blog.Name));
b.Property(x => x.ShortName).IsRequired().HasMaxLength(BlogConsts.MaxShortNameLength).HasColumnName(nameof(Blog.ShortName));
@ -50,7 +50,7 @@ namespace Volo.Blogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "Posts", options.Schema);
b.ConfigureFullAuditedAggregateRoot();
b.ConfigureByConvention();
b.Property(x => x.BlogId).HasColumnName(nameof(Post.BlogId));
b.Property(x => x.Title).IsRequired().HasMaxLength(PostConsts.MaxTitleLength).HasColumnName(nameof(Post.Title));
@ -67,7 +67,7 @@ namespace Volo.Blogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "Comments", options.Schema);
b.ConfigureFullAuditedAggregateRoot();
b.ConfigureByConvention();
b.Property(x => x.Text).IsRequired().HasMaxLength(CommentConsts.MaxTextLength).HasColumnName(nameof(Comment.Text));
b.Property(x => x.RepliedCommentId).HasColumnName(nameof(Comment.RepliedCommentId));
@ -81,7 +81,7 @@ namespace Volo.Blogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "Tags", options.Schema);
b.ConfigureFullAuditedAggregateRoot();
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength).HasColumnName(nameof(Tag.Name));
b.Property(x => x.Description).HasMaxLength(TagConsts.MaxDescriptionLength).HasColumnName(nameof(Tag.Description));
@ -94,6 +94,8 @@ namespace Volo.Blogging.EntityFrameworkCore
{
b.ToTable(options.TablePrefix + "PostTags", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.PostId).HasColumnName(nameof(PostTag.PostId));
b.Property(x => x.TagId).HasColumnName(nameof(PostTag.TagId));

Loading…
Cancel
Save