Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Remove unused SaveChanges APIs in EF DbContext Interfaces #3732

Closed
beforan opened this issue Oct 14, 2019 · 6 comments
Closed

Remove unused SaveChanges APIs in EF DbContext Interfaces #3732

beforan opened this issue Oct 14, 2019 · 6 comments
Assignees
Milestone

Comments

@beforan
Copy link

beforan commented Oct 14, 2019

Quick note first: I've tried to look around at existing questions related to this area (#3507 #2067) and frankly that makes this more confusing.

Question

IConfigurationDbContext and IPersistedGrantDbContext both expect implementors to provide the following method in addition to the expected DbSets:

Task<int> SaveChangesAsync();

However, EF Core's DbContext provides an implementation that takes 1 optional parameter, which should presumably suffice for any call sites working with these interfaces.

Furthermore, as per the issues linked above, I see that IdentityServer4's EF Stores don't actually call SaveChangesAsync() (this is a work in progress as per #3674), which suggests to me the interfaces don't need the method implementing as it will never be called anyway.

Really I'm just making sure I don't need to do something important when implementing these interfaces, and if I have noticed this unnecessary requirement, maybe the interfaces can be updated to reflect that.

@scottbrady91
Copy link
Member

I don't remember exactly why. I think it dates back to Entity Framework Core 1.x method signatures. It's something that can be updated, but unfortunately, it's a breaking change.

You're not missing anything. The default implementation just calls base: https://github.com/IdentityServer/IdentityServer4/blob/master/src/EntityFramework.Storage/src/DbContexts/ConfigurationDbContext.cs#L82

@brockallen
Copy link
Member

Yep. I think in a 4.0 we can revisit it.

@brockallen brockallen added this to the 4.0 milestone Dec 6, 2019
@brockallen brockallen changed the title Why do the EF DbContext Interfaces require a parameterless SaveChangesAsync() implementation? Revisit why the EF DbContext Interfaces require a parameterless SaveChangesAsync() implementation. Dec 6, 2019
@stale
Copy link

stale bot commented Jan 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 10, 2020
@stale stale bot removed the wontfix label Jan 10, 2020
@brockallen
Copy link
Member

brockallen commented Mar 24, 2020

Yea, there are 2 Save APIs -- any objections to removing both (on the config interface)? We'd remove just the sync one on the grants interface.

@brockallen brockallen removed the pinned label Mar 24, 2020
@brockallen brockallen changed the title Revisit why the EF DbContext Interfaces require a parameterless SaveChangesAsync() implementation. Remove unused SaveChanges APIs in EF DbContext Interfaces Mar 24, 2020
@brockallen
Copy link
Member

Done

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants