Effort Framework does not recognize Entity Model schema

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

Question

I have an entity model of a Sybase ASE database and I am trying to use the Effort Framework to create unit tests for it. I am able to access the database with the entity model in both my main project and unit test project, however when try to use Effort to create an in memory database, I get an exception.

Problem Code in Unit Test project

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

}

Exception Details: (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.

Stack Trace

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)   

After looking at the .csdl and .ssdl files that Entity made, I believe I found the fields causing the problem.

SSDL

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

CSDL

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

I tried removing the Precision attribute from the SSDL fields, but but I still received the same error. (Even if it did work, the changes would probably not persist when the model is regenerated )

Anyone thoughts on what is causing the exception and how I should resolve it?

Popular Answer

if you have not done so jet upgrade MySQL server to 5.6+ this has been added then update all your date, datetime, time ...... with the with option's 0-6 in ()




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why