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
The Provider Manifest is incorrect #93
Comments
@jdavi37 To use HierarchyId or the spatial you need to load the sql server types from a custom assembly. Not sure exactly how this works for Microsoft.Data.SqlClient, but I'm guessing you need startup code similar to SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
System.Data.Entity.SqlServer.MicrosoftSqlProviderServices.SqlServerTypesAssemblyName = typeof(SqlGeography).Assembly.FullName; Note that I have changed the 'normal' Haven't tried this myself (yet) but I may need to in the future as I too am looking to migrate to MDS and use HierarchyIds in my code. |
I was not able to repro after following the guide for mapping here: https://softwarehut.com/blog/tech/hierarchyid-entity-framework - in a .NET Framework project with Code First from Database. |
Do not understand why this validation error occurs, would like to get a repro project (and information about the SQL Server edition/version in use for the afftected developers) Maybe @bricelam or @ajcvickers has some clue? |
@jdavi37 You can share something and let me know via email: ejlskov at hotmail dot com |
Sent the repro project and some details over to you. |
Thanks for the repor project, unable to repro on my PC. For the affected PCs: Which exact VS version? Do they have: "Microsoft SQL Server System CLR Types" installed? (check in Add/Remove) |
@jdavi37 I honestly have no idea... |
Just a thought: is EntityFramework.dll in GAC? You can run
and look at the result |
It is not in the GAC, according to that command. |
I have run out of good ideas atm |
So I checked again (not sure how I missed it the first time) and we did have EF 6 dlls in the GAC on these machines, and removing them resolves the issue. Thanks so much! |
Hooray!! And thanks for your patience and help. This is also very valuable for future usage of this library, I will add this info to the docs. |
Hello!
My team is working on a project which uses Entity Framework 6.4. However due to project requirements we need to migrate to using Microsoft.Data.SqlClient, and so we are using your NuGet package. We removed references to EntityFramework, installed your nuget package, updated our custom DbContext with the DBConfigurationType attribute
[DbConfigurationType(typeof(System.Data.Entity.SqlServer.MicrosoftSqlDbConfiguration))]
as you mentioned in the readme, and updated all references to System.Data.SqlClient to the new Microsoft.Data.SqlClient.Some of our team members run into this "Provider Manifest/PrimitiveTypeKind" error at runtime when the dbcontext is used. Any ideas as to what might be causing this issue, or next steps to troubleshoot? It seems these environments are having an issue loading "System.Data.Resources.SqlClient.SqlProviderServices.ProviderManifest.xml."
The offending code looks like:
Full Error
(167,34) : error 0005: The 'PrimitiveTypeKind' attribute is invalid - The value 'HierarchyId' is invalid according to its datatype 'http://schemas.microsoft.com/ado/2006/04/edm/providermanifest:TPrimitiveTypeKind' - The Enumeration constraint failed.
(167,10) : error 0122: The value 'HierarchyId' is not a valid PrimitiveTypeKind.
Source = EntityFramework
StackTrace = at System.Data.Entity.Core.Common.DbXmlEnabledProviderManifest.Load(XmlReader reader)
at System.Data.Entity.SqlServer.SqlProviderManifest..ctor(String manifestToken) in //src/ErikEJ.EntityFramework.SqlServer/SqlProviderManifest.cs:line 62
at System.Data.Entity.SqlServer.MicrosoftSqlProviderServices.<>c.b__29_0(String s) in //src/ErikEJ.EntityFramework.SqlServer/MicrosoftSqlProviderServices.cs:line 482
at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func
2 valueFactory)at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifest(String manifestToken)
at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy
2.GetValue(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet
1.Initialize()at System.Data.Entity.Internal.Linq.InternalSet
1.Include(String path) at System.Data.Entity.Infrastructure.DbQuery
1.Include(String path)Thanks for your time.
The text was updated successfully, but these errors were encountered: