0
vladsd created
Is there a way to change the MaxValueLength
[MaxLength(MaxValueLength)]
public virtual string Value { get; set; }
I need to extend to 4000 and abp default is 2000
Thanks.
3 Answer(s)
-
0
I did manual update with, is there other way?
public partial class MySettings : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn<string>( name: "Value", table: "AbpSettings", nullable: true, maxLength: 4000, oldClrType: typeof(string), oldMaxLength: 2000, oldNullable: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn<string>( name: "Value", table: "AbpSettings", nullable: true, maxLength: 2000, oldClrType: typeof(string), oldMaxLength: 4000, oldNullable: true); } }
-
0
Hi @vladsd,
You can do it in the onModelCreating of your dbContext. So, add migration command will produce related migration for you.
Example <a class="postlink" href="https://docs.microsoft.com/en-us/ef/core/modeling/max-length#fluent-api">https://docs.microsoft.com/en-us/ef/cor ... fluent-api</a>.
-
0
Thanks @ismcagdas, got it, I used it for other properties. Fluent is a good addition to EF apis.