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

Made FluidityRepository disposable #50

Merged
merged 2 commits into from
May 30, 2018
Merged

Made FluidityRepository disposable #50

merged 2 commits into from
May 30, 2018

Conversation

drpeck
Copy link
Contributor

@drpeck drpeck commented May 30, 2018

My FluidityRepository implementation would ideally be IDisposable, as it uses a disposable resource. This PR makes IFluidityRepository and FluidityRepository<TEntity, TId> disposable, though the default repository disposes of nothing. I added it to both only becauseIFluidityRepository is marked as obsolete, thought it is clearly widely used so perhaps this is unnecessary.

Additionally where an IFluidityRepository object is instantiated I've disposed of the object after use.

This was really quick to achieve. Please know that I take absolutely no offence if you think it isn't a useful inclusion.

@mattbrailsford
Copy link
Owner

Nice addition. IFluidityRepository is obsolete because I don't want people using it directly, however internally we do treat everything as IFluidityRepository (Abstract repo and the default repo are both IFluidityRepository, but the default repo doesn't implement the abstract one, hence the need for the intetrface).

On the face of it, this seems fine to me, but given the info above, maybe we make IFluidityRepository IDisposable?

@mattbrailsford
Copy link
Owner

Oops, just noticed you actually have. Though that should mean you shouldn't need to implment IDispoable at the concrete class level as it's implied by IFluidityRepository

Copy link
Owner

@mattbrailsford mattbrailsford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment really

@@ -20,7 +20,7 @@ namespace Fluidity.Data
/// <typeparam name="TEntity">The type of the entity.</typeparam>
/// <typeparam name="TId">The type of the identifier.</typeparam>
/// <seealso cref="Fluidity.Data.IFluidityRepository" />
public abstract class FluidityRepository<TEntity, TId> : IFluidityRepository
public abstract class FluidityRepository<TEntity, TId> : IFluidityRepository, IDisposable
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is IDisposable necesarry here as IFluidityRepository implement IDisposable anyway?

Copy link
Contributor Author

@drpeck drpeck May 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not. It was only the ObsoleteAttribute on the interface that caused me to add it here, for fear that if the interface was removed without IDisposable being moved over to the abstract class. It sounds like this is unnecessary duplication though so I'll remove it. 2 secs.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, IFluidityRepository whilst marked as obsolete, won't be removed. It's purely to stop it being used directly.

@drpeck
Copy link
Contributor Author

drpeck commented May 30, 2018

Not sure if you get alerted to the push I just did for the requested change.

@mattbrailsford mattbrailsford merged commit a6c5924 into mattbrailsford:develop May 30, 2018
@mattbrailsford mattbrailsford added this to the 1.0.3 milestone Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants