Architecture :: Interaction Between UnitOfWork And Repository Patterns?

May 31, 2010

I read some article about unitOfwork and repository but i'm still confused about how they interact, and how to use them in the right way.

I'm using an addressbook project to practise on patterns (even if , likely, patterns are not usefull) without any ORM framework for persistence.

My domain objects are (at now) : AddressBook (acts as an application controller), Contact (contains information about each contact in the address book), ContactGroup (mantain collections of contact).

Should i have to use distinct repository object for contact ad contactgroup?

I thought to use a UnitOfWork for the operation about the adding/removing contact to group : the user can add existing contact to a group, create a new contact while adding it to the group or remove contact from group.

View 1 Replies


Similar Messages:

Architecture :: EF4 With Repository And Unit Of Work Patterns?

Sep 26, 2010

I've been reading recently about EF4, and how to build an architecture for asp.net web forms application using it.

I explored using POCOs (self tracking entities), with WCF, but found out that my application will be deployed on a single box (i.e. one tier), so I started reading about logical separation of layers, and came up with the following solution:

DAL layer that contains EDMX model and EF APIs, and also generated context object.Entities DLL that holds all generated POCO entities using ADO.NET POCO entity generator. (for persistence ignorance, and decoupling entities from DAL).Business layer that contains a façade for each related group of business functions, the façade will be aware of and using DAL layer. And in each function, it will initiate context and uses different entities to carry out specific job (i.e. function).UI layer that only calls the business layer façade classes. With no awareness of DAL, but it will be aware of entities (i.e. using entities DLL), as the business layer will return results basically as entity collections.

I want to know what you think about this architecture.

I also read about an architecture that uses repository and unit of work patterns, but what I understand that context object is already implementing a UOF pattern, and also object sets are implementing repository pattern (correct me if I'm wrong), so the only advantage of using additional abstraction over them is to make the business layer communicates to my classes, not EF classes, and this is good only if the DAL strategy might change (i.e. by using another tool other than EF, which is not my plan).

View 8 Replies

Architecture :: Design Patterns Vs Architectural Patterns

Jan 10, 2011

1.what is the difference between design patterns vs architectural patterns ?

2. In which situations They are preffered?

View 2 Replies

Architecture :: Architecture And Design Patterns?

Mar 16, 2011

hat is the difference between Architecture and Design patterns ?

View 8 Replies

Architecture :: .NET Web-Application Architectures / Patterns?

Jul 9, 2010

Does anybody knows good, short and slim tutorials (not here ), which describe actual/modern web-application architectures / patterns (especially for ASP.NET based (classic and MVC) applications (maybe also with embedded Silverlight components) ? How would you you design today an ASP.NET application which uses different datasources (databases, services,...) ? Background: I has been away a couple of years writing web applications, and I want to start now again. So at the moment I am a little bit unsure, how to take off and find the right starting point.

View 3 Replies

Architecture :: Factory Patterns Implemented In .Net Framework?

May 17, 2010

I am having troubles understanding the purposes of using Factory pattern, I understand Factory pattern uses Factory class that has methods to return concrete objects. But why don't I simply use new opertor to create concrete objects? Some articles suggest Factory methods could return objects of different concreate classes, I can do the same thing by using switch statement.

Also are there classes in .Net framework already implementing Factory pattern? I think that will give me a better ideas why it is useful.

View 5 Replies

Architecture :: Design Patterns For Handling User Web Navigation And Flow?

Jan 20, 2011

Our site is expected to allow the user to do whatever they want from a number of different places. Except, that doing whatever they want really means firing off mini sequences of pages they must vist (or possibly abort from to go off to another task) before returning to their starting point. So, at any given time, the user has a list of pages they are allowed to go to, a list of pages they must go to in order to complete their task, and some end point they must eventually return to, all of which are constantly changing.

As an example, a user may choose to edit an order they placed, at which point they must step through a series of pages to edit the order. These pages to edit an order may be different based on the type of order they are editing, and they must return to whatever place they were at when they decided to start editing the order. They may also have certain options of other pages to visit during their order editing process.

I really need a good way to handle this for a large number of different scenarios, and allow it to be easily changed. Right now we are doing things like setting session variables when a user chooses an action and checking them within the page on button handlers to see what they are allowed to do or where they are allowed to go. I'd love to be able to abstract this out into something that can be easily examined in one place, or even data driven, and have some sort of navigation controller pointing them to the pages they can or must go.

View 6 Replies

Architecture :: MVC Linq To Sql Repository And Search

Apr 15, 2010

I need some guidance for an application I am working on. I have searched the web and the forum and found parts that answer my questions but I want to do this correctly. My solution uses LINQ to SQL to model the db and I have a repository that is querying my db everytime a controller needs to get some data for the view. I am initially anticipating a maximum of only about a few hundreds hits per day (if that). The website is a directory, with listings and requires a search functionality.

1. What options should I consider to avoid having my repository query the db everytime

2. The site contains a 'search' option, how can I implement this against my repository?

I guess I'm really looking for someone to point me in the right direction. So far I've looked at 'caching' the LINQ to SQL model and Lucene.NET but both seem overkill or am I missing the point?

View 3 Replies

Architecture :: Repository Pattern - Pros And Cons?

Jul 8, 2010

This is possibly the worst kind of religious debate -- a religious debate with practical consequences. But it's one that needs to be had, and I can't seem to fit it in my tiny head. Here are the pros and cons of the pattern as I know them:

Pros:

-Encourages DRY (don't repeat yourself) design in that identical queries are written only once per set of query conditions
-Facilitates unit testing by allowing itself to be abstracted into an interface
-Creates an opportunity for business-level validation

Cons:

-Breaks DRY philosophy in that you're generally repeating your database schema
-In a sense breaks separation of concerns, because the query concerns of the controller and view frequently become the concerns of whoever is maintaining the repository
-Determining what should be a repository and what should be returned as a raw associated ORM entity becomes an ambiguous art

To me it seems like all this stuff should be done at the ORM level, but Entity Framework has much fewer hooks than Linq to Sql does, yet Entity Framework tends to be regarded as being more robust, so it seems that this is by design, and that the designers of EF are in fact encouraging another layer. Are there any tools or anything that I could be using for this? Am I missing something?

View 6 Replies

Architecture :: Data Validation In Repository Pattern?

Dec 21, 2010

I am currently using the 3-tier Repository pattern in my application. Actually it's the first time for me to implement a design pattern at all! i used to put all my code in the so called now presentation layer.

i want to implement data validation, for example, password should not be more than 10 characters and have to contain special characters. Should i put this code in the data access layer? but my data access layer contains methods that take the DTO as a parameter for example

[Code]....

and the same is for other CRUD operations (DELETE and UPDATE), so implementing such validation on the DAL would make me duplicate the code in each and every method that accepts the DataObject as a paramter. Same holds for the business logic layer where i am using it as a proxy between the presentation and the data access layers.

Eventually it has to use the same Data Objects as parameters. This only leaves me with one option which is to do the validation on the Data Object part. But i think this is not the essence of the respository pattern which states that the Data object class should only be a "container" class with no behavior.

View 1 Replies

Architecture :: Should The Unit Of Work Point To The Service Layer Or The Repository And Then The Repository Point To The Service Layer

Jan 26, 2011

Just wondering, in an ASP.NET MVC3 environnement with entity framework. Should the Unit of Work point to the service layer or the repository (and then the repository point to the service layer) ?

Ive saw two example:

* One where the unit of work and repository both have an instance to the service layer..

Link: Entity Framework 4 CTP 4 / CTP 5 Generic Repository Pattern and Unit Testable

Doesn't use a service layer but its obvious that one could be use in that case.

* Second where the unit of work have an instance to the repository which have an instance to the service layer..

[URL]

What would be better ?

View 11 Replies

Architecture :: Difference Between Repository And Table Data Gateway

Apr 1, 2010

what is the difference between these two patterns?

View 1 Replies

Architecture :: Which Kind Of Relationship Exists Between Repository And Registry

Jun 1, 2010

the more i read about pattern the more i get confused!

In particular i'm trying to get the relationship between Registry and Repository.

Is it correct to say that a possible implementation of a Registry uses a Factory to return an appropriate Repository which, in turns, uses an underline DataMapper to performe the CRUD operations against a database?

If no, which kind of relationship exists between repository and registry ?

View 1 Replies

Architecture :: Provider Model Versus Repository Pattern

Feb 4, 2011

I am trying to understand the fundamental differences between the Provider Model and Repository Pattern.

I have used the Provider Model in many many situations and am confident with it when designing applications. However, the more examples I encounter on the internet and asp.net evolution I keep coming across "Repository" Interfaces for classes that look like a Provider Model.

I have dug around a bit but all I can see is that they kinda do the same thing, or closely overlap by enforcing an inheriting class to adhere to a "contract" of implemented / abstracted methods etc...is there more to it?

View 1 Replies

Traditional Repositories Vs Single UnitOfWork

Aug 17, 2010

I would like to start a debate on traditional repositories versus one built on the UnitOfWork pattern. In a traditional repository, we wrap inserts, updates and deletes in a transaction, but selects don't really need them. In addition, nhibernate configuration is typically done once per application due to BuildSessionFactory being rather expensive. We often have several repositories of this type (one per aggregate chain). We also need to have projected, ahead of time, exactly what kinds of queries we'll need in order to build the interfaces and concretes correctly. In a single UnitOfWork repository we have the ability to manage both the current session and transaction, perform several operations, and then commit any changes all at once. In such a repository we may opt to put our configuration in the constructor since (typically speaking) no more than one Action is called per request anyway, initializing it in the application doesn't seem like much of an overall gain in speed. I must admit, I'm very temped to use the UnitOfWork pattern, as the following code looks really nice to me:

Csharp Code:
using (IUnitOfWork worker = new UnitOfWork()){// session and transaction are now both set
// save changes to three itemsworker.SaveOrUpdate(item1);worker.SaveOrUpdate(item2);worker.SaveOrUpdate(item3);
// grab a fourth var item4 = worker.Criteria<Foo>().Add(Expression.Eq("title", title)).UniqueResult<Foo>();
// delete the fourthworker.Delete(item4);
// all pending operations are commited or rolled back as a single unit (if one fails, all are rolled back), and then disposed, along with the session}

My proposed UnitOfWork class is rather simple. It implements IDisposable where I use a try-catch-finally in Dispose() to attempt a tx.Commit(), doing a tx.Rollback on failure, and a cleaning everything up in the finally clause. It also exposes common things like SaveOrUpdate, Delete, GetAll, Get, and even a Critera<T>() for custom on-the-spot queries. So what are your thoughts on this? I'd really like to hear about your experience with this pattern.

View 4 Replies

Interaction Between WCF, DAO And DTO Layers In An Application

Feb 25, 2011

how the WCF, DAO and DTO layers communicate with each other? I would appreciate if someone can specify which layer comes first and then how it interacts with the next layer

View 1 Replies

How To Scrape An .NET Site That Does All Interaction As Postbacks

Apr 4, 2011

I built a scraper for an ASP.NET site (specifically a Jenzabar course searching portlet) that would create a new session, load the first search page, then simulate a search by posting back the required fields. However, something changed, and I can't figure out what, and now I get HTTP 500 responses to everything. There are no new fields in the browser's POST data that I can see.I would ideally like to figure out how to fix my own scraper, but that is probably difficult to ask about on StackOverflow without including a ton of specific contex

View 4 Replies

How To Open File Through Interaction.Shell

May 18, 2010

I have written this code for opening a text file ,but its saying that file not found.

[Code]....

View 5 Replies

MVC :: Complex View/user Interaction?

Jun 26, 2010

Basically I have a page where a user can select up to 3 vehicles by make and model. I have 3 divs on the page that is generated with a basic foreach loop. When the user selects a make and model from respective dropdown lists I am firing a javascript function that returns a JSonResult that loads a dynamic partial view into a seperate div. This partial view displays a div with a grid whereby the user can select one of n-number of services using a checkbox.Next what I would like to do is if the user selects a servce for the one of the vehicle selections, I would like to add this selection to a list of "ServiceSelection" that is part of my viewmodel. Ultimately the user would click a button that would redirect to the next step in the process and pass the entire updated viewmodel to this new page.

View 1 Replies

Web Forms :: Making Telephone Interaction With Application

Aug 4, 2010

I want to understand the interaction of telephone with webforms application.

In order to do that I want to create a small application which will be able to receive multiple calls at a time, place them in a queue and then forward calls one by one to a call answerer.

It should also be able to retrieve the Caller Id i.e number from which the call is being made.

How this may be achieved?

If there is any ready made solution available with source code pls provide links.

View 2 Replies

Web Forms :: Interaction With LinkButtons Added At Runtime

Jan 9, 2010

I am working on a web application project in which i add a dynamic number of LinkButtons at runtime according to user selection, each link should redirect the user to a specific web page ,but what actually happened is that the last hyperlink is the only one responded! the following code show the declaration :

''''''''Public WithEvents ItemName As LinkButton
''Public Sub AddLinkButtons
''''''''For i = FirstIndex To StopFlag
''''''''ItemName = New LinkButton
''''''''ItemName.Text = Dt.Rows(i).Item(1)
''''''''Me.ContentTD.Controls.Add(ItemName)
''''''''Next
''End Sub
''''''''Private Sub ItemName_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ItemName.Click
''''''''SelectedItemToFind.ItemFlag = 1
''''''''SelectedItemToFind.SelectedItem = sender.Text
''''''''Response.Redirect("Default.aspx?Main=SearchResult")
''''''''End Sub

View 4 Replies

Is JQuery The Best Way Of Dealing With User Interaction In C# .net Environment

Oct 8, 2010

.net has all these build in GUI elements. The purpose is that we build a .net web application and for the coding itselve I'm very familiar with jQuery in PHP but I noticed that in .Net everybody starts using it too.Is jQuery the best way these days to deal with this in .NET (c#)? or are there others you might recommend?

View 5 Replies

Patterns To Use When Building Complex Web UI?

Jun 24, 2010

I need to implement a wizardy, dynamic UI that uses complex validation of the style:

If A = 1, show controls B, C, D. B is required, C is not, and D is not required must be less than 30 if it is populated.

If A = 2, show controls B, D, E. B is not required, D is required but has no limits, and E is not required.

If B is not null, show controls B, D, E. B is not required, D is required but has no limits, and E is not required.

Historically, I have made my presentation layer as "dumb" as possible in that it is only responsible for capturing user input and binding it to the appropriate domain model. The domain model, in turn, contains the logic needed to validate it's state and that of any child objects, and then communicates any invalid state to the presentation layer via notifications. As such, this requirement for a highly "intelligent" UI represents a departure for me.

I think I have no choice but to construct 2 very similar class hierarchies:

one that will capture presentation business rules (i.e. what fields are visible) and control what renders in the View

one that will capture domain business rules (when field A = X, then field B should be not null and in the range of n to m) to disallow objects with an invalid state from being persisted


Sill I have far more questions than answers on my strategy moving forward. Is there a set of design patterns I can draw on to build such a dynamic UI? I do have the option of using ASP.NET MVC or WebForms, so whichever approach will produce cleaner, testable code is preferred.

View 1 Replies

How To Understand The User Patterns

Feb 18, 2010

i created an intranet based website(information Portal)...i would like to know the pages each user visits and i want track there behavior...what tools should i include..

View 2 Replies

Design Patterns & UML Diagrams?

Apr 27, 2010

what are design patterns and UML diagrams with best examples. How we should use in real time scenarios. Recurring iam facing these type of questions in project round.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved