title: ASP.NET MVC: EntityValidationErrors
body: <p>I get an error every time to try to create a new user or register.
  Here is the source:
  Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.</p>
  
  <blockquote>
    <p>Description: An unhand-led exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.</p>
  </blockquote>
  
  <p><strong>Source Error:</strong> </p>
  
  <p>Line 185:
  Line 186:
  Line 187:                var result = await UserManager.CreateAsync(user, model.Password);
  Line 188:                if (result.Succeeded)
  Line 189:                {</p>
  
  <p>Source File: C:\Users\koand\documents\visual studio 2015\Projects\MvcStore\MvcStore\Controllers\AccountController.cs    Line: 187 </p>
  
  <p>My code:</p>
  
  <pre><code> public async Task&lt;ActionResult&gt; Register(RegisterViewModel model, string returnUrl)
          {
  
  
              if (ModelState.IsValid)
              {
                  var user = new ApplicationUser
                  {
                      UserName = model.Email,
                      Email = model.Email
                   };
  
                  var result = await UserManager.CreateAsync(user, model.Password);
                  if (result.Succeeded)
                  {
                      await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
  
                      // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                      // Send an email with this link
                      // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                      // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                      // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking &lt;a href=\"" + callbackUrl + "\"&gt;here&lt;/a&gt;");
  
                      return RedirectToAction("Index", "Home");
                  }
                  AddErrors(result);
              }
  
              // If we got this far, something failed, redisplay form
              return View(model);
          }
  </code></pre>