gpt4 book ai didi

entity-framework - 使用SqlEntityConnection,CLR类型到EDM类型的映射不明确

转载 作者:行者123 更新时间:2023-12-04 07:23:11 24 4
gpt4 key购买 nike

我正在尝试重写一个非常简单的应用程序,从 C# 到 F#,现在使用 SqlEntityConnection 类型提供程序,我遇到了一个 EF 问题:“CLR 类型到 EDM 类型的映射是不明确的”,这可能发生在打开两个 SqlEntityConnections,每个都有一个同名的表。

但是,在这种情况下,这是因为 EF 通过类型提供程序显然是在映射系统表。实际错误引用了 dtproperties 表——

{"Schema specified is not valid. Errors: \r\nThe mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'dtproperties'. Previously found CLR type 'SqlEntityConnection2.dtproperties', newly found CLR type 'SqlEntityConnection1.dtproperties'."}



我怎样才能改变这个被映射的表?谢谢。

(这在也使用 EF 的原始 C# 版本中不是问题。)

最佳答案

这是因为您使用的是 POCO 并且有两种类型名称相同的类型。 EF 会忽略命名空间,因此名称相同但命名空间不同的两种类型对于 EF 来说是不明确的。 ( http://entityframework.codeplex.com/workitem/483 )

关于entity-framework - 使用SqlEntityConnection,CLR类型到EDM类型的映射不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14185631/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com