Effort Framework无法识别实体模型架构

c# effort entity-framework-5 sybase-ase unit-testing

我有一个Sybase ASE数据库的实体模型,我正在尝试使用Effort Framework为它创建单元测试。我可以在我的主项目和单元测试项目中使用实体模型访问数据库,但是当尝试使用Effort创建内存数据库时,我得到一个例外。

单元测试项目中的问题代码

public SetUpShims()
{
     string connString = System.Configuration.ConfigurationManager.ConnectionStrings["CoPathDataContext"].ConnectionString;
     MyDbContext context;
     // CreateTransient throws exception
     EntityConnection conn = Effort.EntityConnectionFactory.CreateTransient(connString);

     context = new Data.CoPathDataContext(conn);

}

异常详细信息:(System.Data.MetadataException)

Schema specified is not valid. Errors: 
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.
(0,0) : error 0063: Precision facet isn't allowed for properties of type double.

堆栈跟踪

at System.Data.Metadata.Edm.StoreItemCollection.Loader.ThrowOnNonWarningErrors()  
at System.Data.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths) 
at System.Data.Metadata.Edm.StoreItemCollection.Loader..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, Boolean throwOnError)  
at System.Data.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerManifestToken, Memoizer`2& cachedCTypeFunction)
at System.Data.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders)   
at Effort.Internal.Common.MetadataWorkspaceHelper.CreateMetadataWorkspace(List`1 csdl, List`1 ssdl, List`1 msl)   
at Effort.Internal.Common.MetadataWorkspaceHelper.Rewrite(String metadata, String providerInvariantName, String providerManifestToken) 
at Effort.EntityConnectionFactory.<GetEffortCompatibleMetadataWorkspace>b__1(String metadata)
at Effort.Internal.Caching.MetadataWorkspaceStore.<>c__DisplayClass1.<GetMetadataWorkspace>b__0()
at System.Lazy`1.CreateValue()   
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Effort.Internal.Caching.ConcurrentCache`2.Get(TKey key, Func`1 factory)  
at Effort.Internal.Caching.MetadataWorkspaceStore.GetMetadataWorkspace(String metadata, Func 2 workspaceFactoryMethod)
at Effort.EntityConnectionFactory.GetEffortCompatibleMetadataWorkspace(String& entityConnectionString)
at Effort.EntityConnectionFactory.CreateTransient(String entityConnectionString, IDataLoader dataLoader)
at Effort.EntityConnectionFactory.CreateTransient(String entityConnectionString)   

在查看Entity创建的.csdl和.ssdl文件后,我相信我发现了导致问题的字段。

SSDL

<Property Name="sequence_num" Type="float" Precision="24" Nullable="false" />

CSDL

<Property Name="sequence_num" Type="Double" Nullable="false" />

我尝试从SSDL字段中删除Precision属性,但我仍然收到相同的错误。 (即使它确实有效,当模型重新生成时,更改可能不会持久)

有关导致异常的原因以及我应该如何解决的任何想法?

热门答案

如果你还没有这样做,将MySQL服务器升级到5.6+,这已添加,然后更新你所有的日期,日期时间,时间......用with选项的0-6 in()



Related

许可下: CC-BY-SA with attribution
不隶属于 Stack Overflow
这个KB合法吗? 是的,了解原因
许可下: CC-BY-SA with attribution
不隶属于 Stack Overflow
这个KB合法吗? 是的,了解原因