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
103 stars 27 forks source link

IDbContext #54

Closed LukeTOBrien closed 4 years ago

LukeTOBrien commented 4 years ago

Hello,

I think an IDbContext would be a good thing.
I pass my context's around using DI, so I always have an interface for each each context, but these interfaces only have the DbSet properties on them, and my repository isn't aware of SubmitChanges etc.
An interface that contains all common DbContext methods would be useful.

Thanks,

Luke

JonathanMagnan commented 4 years ago

Hello @LukeTOBrien ,

I fail to understand how an interface IDbContext would give you more flexibility over the DbContext class? I mean you can also use class for your DI?

If you can give me a good reason, we would be happy to add it since that's not very hard on our side.

Best Regards,

Jon

JonathanMagnan commented 4 years ago

Hello @LukeTOBrien

Since our last conversation, I haven't heard from you.

As mentioned in my previous message, would it be possible to give us further information?

Looking forward to hearing from you,

Jon

JonathanMagnan commented 4 years ago

Hello again @LukeTOBrien !

A quick reminder that we are here to assist you.

don't hesitate to provide further information!

Looking forward to hearing from you,

Jon

LukeTOBrien commented 4 years ago

Hi there,

sorry I have a few projects on the go and I haven't been back on this.

Well I guess the issue is that I have IXXXContext for all my DbContexts, but these interfaces only have the Dbset properties on them. So then in the repo, I call a method likeSaveChanges that doesn't exist on my interface, I either have to pull that method signature into my interface or create a geneal IDbContext interface. I may decide to re-write and resister the classes as services rather than the interfaces.

I think an 'IDbContext couldn't hurt. How do you mock DbContexts for testing without an interface?

Luke

On Mon, May 4, 2020 at 2:48 PM Jonathan Magnan notifications@github.com wrote:

Hello again @LukeTOBrien https://github.com/LukeTOBrien !

A quick reminder that we are here to assist you.

don't hesitate to provide further information!

Looking forward to hearing from you,

Jon

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zzzprojects/EntityFramework-Classic/issues/54#issuecomment-623475019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3KMFJKJDVCCG2NQTSL6KDRP3BUBANCNFSM4MP6IYOA .

JonathanMagnan commented 4 years ago

Thank you @LukeTOBrien ,

You provided a scenario in which an interface could be useful. Since an interface cannot inherit from a class, adding an interface could not be bad.

I will assign this to my developer and ask him to add the minimum information to this interface.

LukeTOBrien commented 4 years ago

Thank you!

On Mon, May 4, 2020 at 6:55 PM Jonathan Magnan notifications@github.com wrote:

Thank you @LukeTOBrien https://github.com/LukeTOBrien ,

You provided a scenario in which an interface could be useful. Since an interface cannot inherit from a class, adding an interface could not be bad.

I will assign this to my developer and ask him to add the minimum information to this interface.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zzzprojects/EntityFramework-Classic/issues/54#issuecomment-623611955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3KMFNW63IFAA5JGMZASSLRP36PVANCNFSM4MP6IYOA .

JonathanMagnan commented 4 years ago

Hello @LukeTOBrien ,

The v7.1.27 has been released.

The IDbContext interface has been added. If something is missing, let us know.

Best Regards,

Jon

LukeTOBrien commented 4 years ago

Thank you!

On Tue, May 5, 2020 at 10:40 PM Jonathan Magnan notifications@github.com wrote:

Hello @LukeTOBrien https://github.com/LukeTOBrien ,

The v7.1.27 has been released.

The IDbContext interface has been added. If something is missing, let us know.

Best Regards,

Jon

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zzzprojects/EntityFramework-Classic/issues/54#issuecomment-624321335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3KMFJR53A4UT3MQFKNJZTRQCBVFANCNFSM4MP6IYOA .