I have an interface defined as IStore, with two methods:
public interface IStore<TEntity>
{
TEntity Get(object identifier);
void Put(TEntity entity);
}
I want an event to be raised on the success of Put (for reference, Put could store a row in a db, or file on the file system etc...)
So, a class implementing Istore for type of Product would look a bit like this:
class MyStore : IStore<Product>
{
public Product Get(object identifier)
{
//whatever
}
public void Put(Product entity)
{
//Store the product in db
//RAISE EVENT ON SUCCESS
}
}
What i'm after, is a way of ensuring that every implementation of IStore raises the event - should i have an abstract class instead, or as well as, the interface?