repository-pattern

Transactions in the Repository Pattern

非 Y 不嫁゛ 提交于 2019-11-28 16:12:23
How do I encapsulate the saving of more than one entity in a transactional manner using the repository pattern? For example, what if I wanted to add an order and update the customer status based on that order creation, but only do so if the order completed successfully? Keep in mind that for this example, orders are not a collection inside the customer. They are their own entity. This is just a contrived example, so I don’t really care whether orders should or should not be inside the customer object or even in the same bounded context. I don’t really care what underlying technology will be

Is Unit Of Work and Repository Patterns very useful for big projects?

感情迁移 提交于 2019-11-28 16:00:54
问题 I'm starting a new web project using ASP.NET Webforms + EF4. I'm trying to apply a repository pattern with a unit of work pattern following this tutorial : http://www.dotnetage.com/publishing/home/2011/07/05/6883/the-repository-pattern-with-ef-code-first-dependeny-injection-in-asp-net-mvc3.html I think I got the idea but my question is that, when I create a new object in the model, do I also have to define that object in IDALContext of the Unit Of Work? Isn't that a handbreak for rapid

DDD - How to implement high-performing repositories for searching

眉间皱痕 提交于 2019-11-28 15:55:01
I have a question regarding DDD and the repository pattern. Say I have a Customer repository for the Customer aggregate root. The Get & Find methods return the fully populated aggregate, which includes objects like Address, etc. All good. But when the user is searching for a customer in the UI, I just require a 'summary' of the aggregate - just a flat object with summarised information. One way I could deal with this is to call the find method on the repository as normal, and then in the application layer, map each customer aggregate to a CustomerSearchResult / CustomerInfo DTO, and send them

What specific issue does the repository pattern solve?

可紊 提交于 2019-11-28 15:28:37
(Note: My question has very similar concerns as the person who asked this question three months ago, but it was never answered.) I recently started working with MVC3 + Entity Framework and I keep reading that the best practice is to use the repository pattern to centralize access to the DAL. This is also accompanied with explanations that you want to keep the DAL separate from the domain and especially the view layer. But in the examples I've seen the repository is (or appears to be ) simply returning DAL entities, i.e. in my case the repository would return EF entities. So my question is,

Repository Pattern - How to understand it and how does it work with “complex” entities?

梦想与她 提交于 2019-11-28 15:08:22
I'm having a hard time understanding the Repository Pattern. There are a lot of opinions on that topic like in Repository pattern done right but also other stuff like Repository is the new Singleton or again like in Don't use DAO use Repository or just take Spring JPA Data + Hibernate + MySQL + MAVEN where somehow a Repository appears to be the same as a DAO object. I'm getting tired of reading this stuff since imho this can't be such a hard thing as it is displayed in a lot of articles. I see it like this: It appears that what I want is something like this: -----------------------------------

How to use the repository pattern correctly?

笑着哭i 提交于 2019-11-28 15:02:20
I am wondering how should I be grouping my repositories? Like from the examples I seen on the asp.net mvc and in my books they basically use one repository per database table. But that seems like a lot of repositories leading you to have to call up many repositories later on for mocking and stuff. So I am guessing I should group them. However I am not sure how to group them. Right now I made a registration Repository to handle all my registration stuff. However there are like 4 tables I need to update and before I had 3 repositories to do this. For example one of the tables is a license table.

Repository Pattern with Entity Framework 4.1 and Parent/Child Relationships

霸气de小男生 提交于 2019-11-28 13:54:59
问题 I still have some confusion with the Repository Pattern. The primary reason why I want to use this pattern is to avoid calling EF 4.1 specific data access operations from the domain. I'd rather call generic CRUD operations from a IRepository interface. This will make testing easier and if I ever have to change the data access framework in the future, I will be able to do so without refactoring a lot of code. Here is an example of my situation: I have 3 tables in the database: Group , Person ,

Difference between a Factory, Provider and a Service?

谁说我不能喝 提交于 2019-11-28 13:49:09
问题 What is the difference between the terms Factory, Provider and Service? Just getting into NHibernate and its Repository pattern (POCO classes, etc). 回答1: Factory : Assembles classes, either by composing a bunch of bits together, or choosing type based on some kind of context Provider : Provider is something microsoft "invented" (basically an abstract factory pattern) that is a way of doing a factory of factories, or having a common factory interface which allows factories to be swappable. It

Well designed query commands and/or specifications

ε祈祈猫儿з 提交于 2019-11-28 13:11:03
问题 I've been searching for quite some time for a good solution to the problems presented by the typical Repository pattern (growing list of methods for specialized queries, etc.. see: http://ayende.com/blog/3955/repository-is-the-new-singleton). I really like the idea of using Command queries, particularly through use of the Specification pattern. However, my problem with specification is that it only relates to the criteria of simple selections (basically, the where clause), and does not deal

Managing relationships in Laravel, adhering to the repository pattern

ⅰ亾dé卋堺 提交于 2019-11-28 13:07:41
问题 While creating an app in Laravel 4 after reading T. Otwell's book on good design patterns in Laravel I found myself creating repositories for every table on the application. I ended up with the following table structure: Students: id, name Courses: id, name, teacher_id Teachers: id, name Assignments: id, name, course_id Scores (acts as a pivot between students and assignments): student_id, assignment_id, scores I have repository classes with find, create, update and delete methods for all of