0

I have created a base class for my Unit of Work called BaseUoW that inherits IDisposable like so:

public class BaseUoW : IDisposable
{
}

My question is... If i create class called UserUoW for example that inherits my BaseUoW does the UserUoW need to implement IDisposable or will it be handled by my BaseUow

public class BaseUoW : IBaseUoW
{
}

Or

public class BaseUoW : IBaseUoW, IDisposable
{
}

IBaseUoW

public interface IBaseUoW
{
    virtual void Dispose(bool disposing);
    void Commit();
}
DavidG
  • 113,891
  • 12
  • 217
  • 223
Tron Diggy
  • 95
  • 1
  • 8
  • 2
    Pictures of code? No. Please, no. –  Jun 19 '15 at 15:27
  • 1
    answer depends entirely on IBaseUoW interface which is not shown – ranquild Jun 19 '15 at 15:28
  • I've removed your images and made them code. Please learn how to post and format questions on StackOverflow. – DavidG Jun 19 '15 at 15:38
  • Thanks image police. – Tron Diggy Jun 19 '15 at 15:42
  • Note: duplicate is based on title of the post, code of the post *does not* support title's claim as `IBaseUoW` does not implement `IDisposable`. Please edit your post if duplicate does not answer your question to clarify what you are asking. (Consider adding comment to me with `@alexei`when you done editing so I can remove my duplicate vote). – Alexei Levenkov Jun 19 '15 at 15:47

1 Answers1

1

You don't need to add it to the class declaration, unless you want to make it explicit for readability.

However, what you may need, is to add a protected virtual void Dispose(bool disposing){ method override to perform the child class' clean up tasks if there are any.

See here for more information on the proper pattern to follow.

EDIT: As pointed out in the comments, this is only if you are truly extending from your base BaseUoW class. Because your "pictures" show it implementing some other interface, not extending your base class in question.

sstan
  • 35,425
  • 6
  • 48
  • 66