EntityFrameWork Parameter '@columnType' must be defined.

环境: EntityFrameWork  CodeFirst+MySql

今天在提交一个外键字段的修改时报“Parameter ‘@columnType‘ must be defined.”

google了一下

解决方法在链接字符串中加入这样一句话“;Allow User Variables=True”就可以了。

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

后记

事件简单重现一下。

有三个表。一个流水,一个类型表和用户表,主键用的是GUID。

流水表实体一开始我是直接引用“类型表”和“用户表”的实体。EF自动给我在数据库的“流水表”中键了。“类型_ID”和“用户_ID”这样的字段。

在实际使用时才发现添加流水表记录时系统会自动往“类型表”和“用户表”中添加一条记录(我给流水表中的类型和用户字段赋了值)。因为添加的记录的ID是已经存在的。会报主键重复的错误。所以决定改用手动字义外键字段的方式。

在流水表实体中添加了“类型表ID”和“用户表ID”。然后提交修改。结果报错了。说外键不存在。我在数据库管理工具中看了下发现索引和外键都不存在。于是就把迁移的代码中的删除外键和索引都注释了如:

再提交"update-database -verbose"。结果还是报错了。这次报的就是“Parameter ‘@columnType‘ must be defined.”了。

EntityFrameWork Parameter '@columnType' must be defined.

时间: 2024-07-29 21:15:45

EntityFrameWork Parameter '@columnType' must be defined.的相关文章

fido-u2f-raw-message-formats(译)

U2F协议支持两种操作,注册和认证.注册操作将依赖方引入在U2F令牌的控制下的新鲜制造的秘钥对.认证操作 证明拥有先前注册的秘钥对依赖方.注册和认证操作包括三个阶段: 1.设置:在此阶段,FIDO客户端联系依赖方并获取一个challenge,使用这个challenge(以及从依赖方获取的其 他数据或有FIDO客户端自己准备),FIDO Client prepares a request message for the U2F Token. 2.处理:在这个阶段,FIDO客户端发送请求消息到令牌,

因为diagwait未配置导致RAC脑裂日志记录不完整的分析案例

1.故障现象 一个RAC,CRS版本为10.2.0.4,在第二节点DOWN机后,第一节点也相继DOWN机. 2.CRS日志分析 2.1 二节点日志情况 CRS_LOG [cssd(8796)]CRS-1611:node XXdb1 (1) at 75% heartbeat fatal, eviction in 14.118 seconds 2014-07-04 22:49:38.556 [cssd(8796)]CRS-1611:node XXdb1 (1) at 75% heartbeat fa

Microsoft SQL Server Version List(SQL Server 版本)

原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Service Packs (SP), Cumulative Updates (CU), patches, hotfixes and other builds of MS SQL Server 2014, 2012, 2008 R2, 2008, 2005, 2000, 7.0, 6.5 and 6.0 tha

Fatal error encountered during command execution

MySQL + .net + EF 开发环境,调用一处sql语句报错: Fatal error encountered during command execution[sql] view plain copy print?SELECT @r AS cateid,(SELECT @r := b.ParentId FROM cmscontentcategory b WHERE b.id = cateid) AS parentid FROM (SELECT @r := '75422ccd151c48

How to read the HTML DTD

Contents 1. DTD Comments 2. Parameter Entity definitions 3. Element declarations . Content model definitions 4. Attribute declarations . DTD entities in attribute definitions . Boolean attributes Each element and attribute declaration in this specifi

2014鞍山现场赛H题HDU5077(DFS减枝+打表)

NAND Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 65    Accepted Submission(s): 14 Problem Description Xiaoqiang entered the "shortest code" challenge organized by some self-claimed a

实现UDP高效接收/响应

环境Linux g++6.3.0 问题一:一个ip地址如何接收高并发请求 问题二:如何高并发响应消息 发送请求端只能通过ip地址+端口号向服务器发送请求码,所以服务器只能用一个UDP去绑定此ip以及端口号.而如何完成高并发发送响应消息, 谁去发送这个响应消息,接收请求信息的UDP?这就造成其中一个任务必须等待另一个任务执行完毕,sendto是非阻塞,而recvfrom是阻塞,若 执行recvfrom碰巧没有下个请求信息或者网络阻塞造成UDP丢失,那么sendto岂是不能执行(一直等待recvfr

Video for Linux Two API Specification revision0.24【转】

转自:http://blog.csdn.net/jmq_0000/article/details/7536805#t136 Video for Linux Two API Specification Revision 0.24 Michael H Schimek <[email protected]> Bill Dirks Hans Verkuil Martin Rubli Copyright © 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,

Configuring the JA-SIG CAS Client --官方

1. for Java using Spring Configuration of the CAS Client for Java via Spring IoC will depend heavily on their DelegatingFilterProxy class. For each filter that will be configured for CAS via Spring, a corresponding DelegatingFilterProxy is needed in