First Name must be less than 250 Character C# but i have checked my backend no such thing [closed]

First Name must be less than 250 Character C# but i have checked my backend no such thing [closed]

I don't know what I am doing wrong here

First Name must be less than 250 Character C# but i have checked my backend no such thingRead more

   public class CreateMemberView
 {    
     [Required(ErrorMessage = "FullName is Required")]
     public string FullName { get; set; }     
     [Required(ErrorMessage = "Gender is Required")]
     public Gender? Gender { get; set; }
     [Required(ErrorMessage = "Country is Required")]
     public int? CountryId { get; set; }       
     [Required(ErrorMessage = "Display Name is Required")]
     public string DisplayName { get; set; }
     public string ProfilePicUrl { get; set; }
     public IFormFile? FileUpload { get; set; }
     public byte[] ProfilePic { get; set; }      
     [MinAge(18, "You must be 18 year old to use this platform")]
     [Required(ErrorMessage = "Date Of Birth is Required")]
     public DateTime? DateOfBirth { get; set; }
}

Answer

Check for the following:

Search Your Codebase

Use your IDE’s "Find in Files" feature to search for:MaxLength(250) StringLength(250)

"First Name must be less than 250 characters"

If your frontend (e.g., Angular, React) has validation rules, it could send invalid data to the API. Check client-side validation logic.

Locating EF Fluent API Configuration If you’re using Entity Framework’s Fluent API, check your DbContext class:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<User>()
        .Property(u => u.FirstName)
        .HasMaxLength(250); 
}

Enjoyed this article?

Check out more content on our blog or follow us on social media.

Browse more articles