c# - Generic repository - IRepository<T> or IRepository -


I have seen two different ways to make general treasures. What is the difference between those two approaches (professional and opposition)? Please do not worry about the differences in the methods because I

  public interface IRAP resource & lt; T & gt; Interested in the difference between. Where T: class  

and

  public interface erupository: IDisposable  

What is the difference in functionality, flexibility , unit testing ... ? What will I get or lose?
Whether dependency injection frameworks are registered or not?

Option 1

  Public Interface Erepository & lt; T & gt; Where T: class {T obtaining (object ID); Zero Attachment (T Entity); IQueryable & LT; T & gt; get all(); Insert zero (T entity); Zero removal (t organization); Submit Zero (); }           & Gt; (); delete zero & gt; T & gt; (T entity); Add zero; T & gt; (T Entity); Nonsecurity (); Bull IsisSpold (); The biggest difference is that  IRAPSorporation 

irp consentory is potentially bound for multiple types Appropriate is highly dependent on your particular scenario

Normally speaking, I'm more useful to the IRepository while using it, it is very clear that the The content of the IRAP source is ( T ), on the other hand it is not within a given IRAPSignatory , it is not clear.

In cases where I have to store many types of objects, I usually see the map Brahmin hereby Aiarapisojitri & lt; T & gt; For example: dictionary & lt; T, IRAPSorporation & lt; T & gt; & Gt; .


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -