The. Net Framework 4.5.1 ASP 5 under New View ungrateful "error while running the selected code generator failed to retrieve metadata there is no parameterless constructor defined for the object"

Source: Internet
Author: User

When creating a new view in the controller, the view interface is selected as follows:

The following error is reported when the add is executed:

The error content is:

Error
An error occurred while running the selected code generator

Unable to retrieve metadata for ' XXX '
No parameterless constructor is defined for this object

Unable to retrieve metadata for ' XXX '. No parameterless constructor defined for the this object.

This mistake has always misled me, thought is the model class question, looked for half a day to find the solution, depressed to die, later discovered is the data context question.

Think of the solution using the DB First + EF + MEF, without the data context so leave it blank, the miracle happened, the view created successfully, how low-level error ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.