0
votes

I had an error caused by length counting on an int

Error:

[Required()]
[Display(Name = "Telefonnummer")]
[StringLength(12)]
public int UserPhoneNumber { get; set; }

After removing the [StringLength(12)] row completely. The validation attribute still seems to exist in memory and is still generating errors for me.

Error on row 78:

Error: The property 'UserPhoneNumber' is not a String or Byte array. Length can only be configured for String and Byte array properties.

Line 76: // This doesn't count login failures towards account lockout

Line 77: // To enable password failures to trigger account lockout, change to shouldLockout: true

Line 78: var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);

Line 79: switch (result)

How do I refresh my applications Entity Framework? I have tried rebooting my computer and saving project, running application, update-database, add-migration, restarting Visual Studio.

Database is offline entity framework.

TL; Removed validation is still haunting me.

2

2 Answers

0
votes

The Solution is to Remove StringLength Attribure from your model. If your are getting same error try to create new Model/View and try again.

0
votes

Solved. Had anoter property with the bloody [StringLength(12)]. My bad