title: Entity framework validation error after updating database and changing model
body: <p>I am working on ASP.NET MVC app that uses EF to work with database. I needed to change one string property that had <code>StringLength(1000)</code> attribute and was mapped to <code>nvarchar(1000)</code> column in the database.</p>
  
  <p>I updated the database to use <code>nvarchar(max)</code> due to recent requierements and removed <code>StringLength(1000)</code> attribute from the model class.</p>
  
  <p>The problem is. Every time I want to insert new entity that has this property with lenght greater than 1000 I get validation error saying it can be only 1000 characters. When it is lower, everything works as expected.</p>
  
  <blockquote>
    <p>The field must be a string or array type with a maximum length of
    '1000'.</p>
  </blockquote>
  
  <p>I have no idea where is this error coming from. There are no triggers or stored procedures. I also tried using attribute <code>MaxLength</code> or <code>StringLenght(int.maxInt)</code> but got the error. There is also no additional configuration with Fluent API..</p>
  
  <p>EDIT: Unfortunately it does not look like dumb problem with not rebuilding solution. I tried it twice now (+ cleanup) and the problem persits. </p>
  
  <p><strong>SOLUTION</strong>: So for some reason there is another model class for the same entity in the project used internally. It was completely without single attribute to its properties. After adding MaxLength to that single property here it works. </p>