EntityFrameWork Parameter & #39; @ columnType & #39; must be defined., mustbedefined

Source: Internet
Author: User

EntityFrameWork Parameter '@ columnType' must be defined., mustbedefined

Environment: EntityFrameWork CodeFirst + MySql

A change to a foreign key field is reported today."Parameter '@ columnType 'must be defined ."

Google

Solution in the LinkStringAdd such a sentence"; Allow User Variables = True"You can.

<Add name = "AccountDB" connectionString = "server = localhost; user id = root; password = root; port = 3306; database = Account; Allow User Variables = True"ProviderName =" MySql. Data. MySqlClient "/>

Postscript

Simply reproduce the event.

There are three tables. A flow, a type table, and a user table. The primary key uses GUID.

At the beginning, I directly referenced the entities of "type table" and "User table. EF automatically typed "streaming water meter" in the database. Fields such as "Type _ ID" and "User _ ID.

The system automatically adds a record to the "type table" and "User table" when the water meter record is added in actual use. (I assigned the type and user field to the water meter. value ). Because the ID of the added record already exists. Duplicate primary key errors are reported. Therefore, we decided to use the method of manually defining foreign key fields.

The "type table ID" and "User table ID" are added to the flow meter object ". Then, submit the changes. An error is returned. The foreign key does not exist. I looked at the database management tool and found that the index and foreign key do not exist. Therefore, the deletion of Foreign keys and indexes in the Migration Code are commented out as follows:

Then, submit "update-database-verbose ". An error is returned. This report is"Parameter '@ columnType' must be defined.

Related Article

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.