2014-10-08 48 views
1

我有一個Sybase ASE數據庫的實體模型,我正在嘗試使用Effort Framework爲它創建單元測試。我能夠在我的主項目和單元測試項目中使用實體模型訪問數據庫,但是當嘗試使用Effort創建內存數據庫時,我得到一個異常。Effort Framework無法識別實體模型模式

問題代碼在單元測試項目

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) 

看.csdl後實體制作的.ssdl文件,我相信我發現了導致問題的字段。

SSDL

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

CSDL

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

我試圖消除從SSDL領域的精密屬性,但但我仍然收到了同樣的錯誤。 (即使它確實起作用,當模型重新生成時,更改可能不會持續)

有人想到是什麼導致異常以及如何解決它?

+0

任何更新? – MiloTheGreat 2017-08-14 07:02:56

+0

@MiloTheGreat不幸的是,我們發現的唯一解決方案是編輯EDMX以刪除導致問題的列,並在我們需要列時使用存儲過程訪問表。 – 2017-08-16 16:26:19

+0

@MiloTheGreat我爲此打開了一個GitHub問題,您可以按照[這裏](https://github.com/tamasflamich/effort/issues/78) – 2017-08-16 16:34:09

回答

0

,如果你還沒有這樣做噴氣升級MySQL服務器到5.6+這已添加然後更新您所有的日期,日期時間,時間......與與選項的0-6()

+0

該問題發生在Sybase ASE數據庫上,而不是MySQL – 2015-03-25 15:12:37