The Registration Form return error "ArgumentNullException: Value cannot be null." in new MVC 6 project

asp.net-core-mvc asp.net-mvc entity-framework-core

Question

I just have created a new simple MVC 6 project (with Entity Framework 7), I added the connection string to database in project.json

Then I made migration to create user tables in database.

After run application, And when go to do register new user, I receive below error after fill registration form and click on Register button:

An unhandled exception occurred while processing the request.

ArgumentNullException: Value cannot be null.
Parameter name: entityType
Microsoft.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName)

Any One can help? Any idea to know more about this error?

1
2
12/18/2015 5:08:11 PM

Popular Answer

This problem occurred because of your model class which was not declared in the ApplicationDbContext.cs

Please add the class like public DbSet<UserDetails> UserDetails { get; set; }

I added this in ApplicationDbContext.cs then error gone and save data correctly.Hope this will help you

1
8/3/2017 12:35:36 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow