Base solution for your next web application
Open Closed

Overriding MaxUserNameLength #1717


User avatar
0
vineforce created

HI, i have a problem with storing Username having length more than 32 characters. i have overrided the username column in table through migration but it still not allowing to store a value more that 32 char.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Please see this forum topiv #1651@26063b0c-6028-4229-9744-2301f19ae305

  • User Avatar
    0
    JeffMH created

    I followed that viewtopic but it's not working for me. I added this code to the User class:

    [MaxLength(AbpUserBase.MaxEmailAddressLength)]
    public override string UserName { get; set; }
    

    EF recognized the change and added the migration, but when I try and save the entity, it fails validation. Any ideas?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you try it like this ?

    [StringLength(100)]
    public override string UserName { get; set; }
    
  • User Avatar
    0
    JeffMH created

    I laughed out loud when i saw that. That fixed it. Very much appreciated!