Hello Can anyone tell me the easiest way to Change String Max length of Name & Surname in AbpUser<TUser> from 32 to 100 ?
6 Answer(s)
-
0
Hi,
You can do it in OnModelCreation of your DbContext <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/17">https://github.com/aspnetboilerplate/mo ... /issues/17</a>
-
0
Thank you fro your help that would be the code
[code] protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<User>().Property(t => t.Name).HasMaxLength(50); modelBuilder.Entity<User>().Property(t => t.Surname).HasMaxLength(50).IsOptional(); }
[/code:2jfgtrv2]
-
0
Actually i succeed to change max length property as previous reply but still got an error after registration
await _unitOfWorkManager.Current.SaveChangesAsync();
Error Message Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. Error Details Name: The field Name must be a string with a maximum length of 32.
-
0
Hi,
It's probably MaxLength attribute on that fields. Can you try to do it like this,
override Name and Surname field in User entitiy.
[MaxLength(50)] public override string Name { get; set; }
-
0
i did excactly as you told me to do but unfortunately i got the same error
-
0
I fount the solution
[StringLength(50)] public override string Name { get; set; } [StringLength(50)] public override string Surname { get; set; }
Thank you