zzzprojects / EntityFramework-Classic

Entity Framework Classic is a supported version of the latest EF6 codebase. It supports .NET Framework and .NET Core and overcomes some EF limitations by adding tons of must-haves built-in features.
https://entityframework-classic.net
Other
102 stars 27 forks source link

Identity with Z.EntityFramework.Classic #21

Closed kkocabiyik closed 5 years ago

kkocabiyik commented 5 years ago

We are trying to combine Entity Framework Identity with Z.EntityFramework.Classic. When we install Identity packages from nuget, it also includes EF. Since Z.EntityFramework.Classic is the fork of orjinal EF the namespaces and classes are duplicated. Thus, it gives the following error on build.

Severity Code Description Project File Line Suppression State Error CS0433 The type ‘DbSet’ exists in both ‘EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ and ‘Z.EntityFramework.Classic, Version=7.0.0.0, Culture=neutral,

I have tried adding alias to differentiate the namespaces but didn't work out. How can we solve this? Is there any example about this?

JonathanMagnan commented 5 years ago

Hello @kkocabiyik ,

What do you mean Entity Framework Identity?

Z.EntityFramework.Classic replace EF6, it's not a third party library. One drawback of this is that other packages need to release a new version compatible with EF Classic since the signing key is not the same.

So if you still have packages that reference EF6, it will unfortunately not work for your project unless this package release a version compatible with EF Classic.

JonathanMagnan commented 5 years ago

Hello @kkocabiyik ,

This issue will be closed since we haven't heard back from you.

We will be happy to re-open it as soon as you provide more information.

Best Regards,

Jonathan

MikeAlhayek commented 1 year ago

@JonathanMagnan I think what @kkocabiyik means here is that in order to user Identity with EF, you'll need to add IdentityDbContext<> class which is found in Microsoft.AspNet.Identity.EntityFramework. However, installing it also forces to install EntityFramework which causes the conflict between EntityFramework and Classic.

I am currently facing the same issue. Not sure if there is a workaround