Search results
Jun 12, 2015 · This is a nice example: The Repository Pattern Example in C#. Basically, repository hides the details of how exactly the data is being fetched/persisted from/to the database. Under the covers: for reading, it creates the query satisfying the supplied criteria and returns the result set
The Repository pattern is a bad design pattern. I work with many old .NET projects and this pattern typically causes "Distributed Transactions", "Partial Rollback" and "Connection Pool Exhausted" errors which could be avoided.
I am learning repository pattern and was reading Repository Pattern with Entity Framework 4.1 and Code First and Generic Repository Pattern - Entity Framework, ASP.NET MVC and Unit Testing Triangle about how they implement the repository pattern with Entity Framework. Saying •Hide EF from upper layer •Make code better testable
Aug 28, 2012 · By using the repository pattern, the way you save /get your entity is kept out of the entity code, i.e. your domain keeping it cleaner and in essence achieving persistence ignorance (or going a long way towards it anyway) So answers: The repository approch is much better; Always go for option 1; Add these methods to the repository class
Feb 17, 2011 · It should go in the Repository if your Repository returns materialized sequences (ICollection<T>, List<T>), etc. But if your returning IQueryable<T> (like i am), i hope you have a service layer mediating between your Controllers and Repository, which executes queries on the IQueryable and materialises them into concrete collections.
Jul 9, 2009 · This pattern is used to encapsulate object creation logic and makes it easier to add new types of objects to the application without modifying the existing code.-> Repository Pattern. The Repository Pattern is a design pattern used to separate the logic that retrieves data from a data source from the business logic that processes the data.
Jun 30, 2014 · The better approach is to use the Proxy or Strategy pattern to apply the caching logic in a separate type, for instance a CachedRepository, which then uses the actual db-centric repository as needed when the cache is empty. I've written two articles which demonstrate how to implement this using .NET/C#, which you will find on my blog, here:
Sep 5, 2014 · If you want to use generic repository (someone tells that it's anti-pattern, but I disagree), your problem becomes more difficult but still stays solvable. Take a look at Specification pattern. Finally, Query Object Pattern is a bit outdated.
Sep 23, 2017 · We could expose it in an repository without dragging references from the EF assembly to other projects. This was removed from EF Core, but since EF6 is open-source, the method that transforms the lambda expressions in paths can easily be extracted to use in EF Core so you can get the exact same behavior.
Sep 28, 2014 · I've found a Repository pattern implementation. Is this implementation of a Delete() method for Generic Repository correct? public virtual void Delete(T entity) { DBEntityEntry entry = this.