Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with columns that have Precision specified on SSDL metadata #78

Open
elliot-j opened this issue Aug 16, 2017 · 8 comments
Open

Issue with columns that have Precision specified on SSDL metadata #78

elliot-j opened this issue Aug 16, 2017 · 8 comments
Assignees

Comments

@elliot-j
Copy link

elliot-j commented Aug 16, 2017

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

@JonathanMagnan
Copy link
Member

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

@JonathanMagnan JonathanMagnan self-assigned this Aug 23, 2018
@elliot-j
Copy link
Author

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

WebApplication2.zip

@JonathanMagnan
Copy link
Member

Thank a lot @elliot-j for the solution,

We will look at it next week,

Best Regards,

Jonathan

@JonathanMagnan
Copy link
Member

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

@elliot-j
Copy link
Author

@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.

@JonathanMagnan
Copy link
Member

JonathanMagnan commented Aug 28, 2018

Anything will do the job as long as we are able to run the project ;)

@elliot-j
Copy link
Author

elliot-j commented Aug 28, 2018

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

@JonathanMagnan
Copy link
Member

Thank @elliot-j ,

I will have my developer try it again probably tomorrow.

Best Regards,

Jonathan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants