Issue with columns that have Precision specified on SSDL metadata
I am using Effort Framework to unit test with a Sybase ASE databse. 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 I still received the same error.
Anyone thoughts on what is causing the exception and how I should resolve it?
Effort Framework Version 1.1.0 NMemory Version: 1.0.0
Hello @elliot-j ,
Is it possible for you to create a sample project with this issue?
We are currently making an issue cleanup and make sure we focus on issues people still require since it will be impossible to make them all (It's a free library!). Since that's has been a long time that this issue has been answered, it might also be already fixed.
Best Regards,
Jonathan
Hi @JonathanMagnan here is a sample project that reproduces the issue on v.1.37 of Effort Framework. I also saw that I omitted that what version of EntityFramework i'm using in my original post. Due to driver limitations of the source database, the project is using EntityFramework v5.0.0
Thank a lot @elliot-j for the solution,
We will look at it next week,
Best Regards,
Jonathan
Hello @elliot-j ,
My developer has some error about the provider is not registered.
Since that's not a database we support and most of them require some custom customization in the AppConfig, it's possible that you update the project to include everything (include dll) that this project requires to reproduce this issue?
Best Regards,
Jonathan
@JonathanMagnan Would giving you the installer for the DB drivers work ? The DB drivers that get referenced in the project depend on a bunch of other DLL's, and teasing out which one's would need to be included will take some digging.
Anything will do the job as long as we are able to run the project ;)
The database drivers can be found at https://drive.google.com/open?id=1c_wZgcG9jeG-VzBjzoun5cMVgT_1861v . I've include a quick README for installing the drivers. Note that you will need either VS 2013 or 2015 (any patch level) in order to register the provider in Visual Studio
If you have any issues accessing, installing, or registering the provider let me know
Thank @elliot-j ,
I will have my developer try it again probably tomorrow.
Best Regards,
Jonathan