I've read many posts of repository patterns but there are some practical problems that do not seem to solve them or explain it I understand about these two samples:
The repository and query patterns are supplemented: The query objects represent the business logic (the WHEEE clauses) and the repository pattern is found in the gate Ipadicate The query takes an object and returns a SELECT WHERE result
The repository should not have business logic: All business logic must be present on the query object
current I have a class that wraps each logical object (which is almost always a unit object) that implements several "gate" methods that add the most complex questions (groups, groups, etc ...) Implement It is a good method because classes are very much due to the boilerplate code for similar questions and in this public way, this class can be used, depending on the context, thus, this class is dependent on the same database. Which makes it unusable for many projects, which is my primary goal refactoring for this project
How Q, which is more complex than a single SELECT WHERE, commercial logic in this repository is applied with these two patterns without leaking? Or if this business logic is not in the repository nor does the query items where is this argument fit?
thanks
some implementation of repository pattern and unit of operation Are flying around on the internet. Some of them are very simple, where the developer basically applies itself to each table itself, some are normal, but not advanced, and some are really good, normal and yet you have a decent, projection and choice. Offer the ability to do so.
This is targeting MVC, which is shown by the interface. I'm focusing on WPF applications so I need to tune it a little bit. But the idea of this unit implementation of the work is very good.
The down side is for this implementation because it relies on some advanced LINQ and EF functionality because it can argue that your underlying access layer is transmitting layers using the repository layer and repository .
This issue occurs when you want to go away, for example, from EF, it is likely that you have to change the interface of your repository.
To show some code snippets to prove this library's power:
_fotoRepository = unitOfWork.RepositoryAsync & LT; Photos & gt; (); Var fotos = await_fotoRepository. Sakri (R = & gt; R Bistel Bonid == Bastel Bone Id || Workstacles Adds (R. Workstuk Metborking INI Value)). SelectSync () Configure (wrong); Using
or projection:
IRAPSorporation & lt; Relatie & gt; RelatieRepository = unitOfWork.RepositoryAsync & lt; Relatie & gt; (); Var relatiesOverviewsEnumerable = relatieRepository .Query () .NoTracking (). Orderbie (q = & gt; q.orderby (d = & gt; d. Rallet id)). Select (b => New RelativiewView {RelatieId = b.RelatieId, name = B. NAM, BTW = BTW, HofedEdress = B. Adressen.Firster Default (A = & gt; AddressType ID == Hofddlers type)}); _relatieOverviews = new reviewable selection & lt; RelatieOverview & gt; (RelatiesOverviewsEnumerable);
No comments:
Post a Comment