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.