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()



許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
這個KB合法嗎? 是的,了解原因
許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
這個KB合法嗎? 是的,了解原因