.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

EF4 with Repository and Unit of Work patterns - Question about an architecture

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :ASP.Net

Hello All,

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:

  1. DAL layer that contains EDMX model and EF APIs, and also generated context object.
  2. Entities DLL that holds all generated POCO entities using ADO.NET POCO entity generator. (for persistence ignorance, and decoupling entities from DAL).
  3. 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).
  4. 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

View Complete Post

More Related Resource Links

Patterns in Practice: The Unit Of Work Pattern And Persistence Ignorance


Jeremy Miller continues his discussion of persistence patterns by reviewing the Unit of Work design pattern and examining the issues around persistence ignorance.

Jeremy Miller

MSDN Magazine June 2009

Solidify Your C# Application Architecture with Design Patterns

design pattern can solve many problems by providing a framework for building an application. Design patterns, which make the design process cleaner and more efficient, are especially well-suited for use in C# development because it is an object-oriented language. Existing design patterns make good templates for your objects, allowing you to build software faster. This article describes several popular design patterns you can use in your own applications, including the singleton, the decorator, the composite, and the state classes, which can improve the extensibility of your applications and the reuse of your objects.

Looking for guidance: wanting to work with AJAX architecture



I'm starting a small website that will be backed by a database, and will allow a small number of users to authenticate and select an entry in the database, and then view (and optionally update) a corresponding entry (think master-detail).

I have some flexibility in how I'll do this, but I'd really like to incorperate some newer AJAX style coding, eliminating some page postbacks. I think this is a great opportunity to learn the concepts well.

I'll probably go with an ASP.NET 4.0 site. From what I've seen there are MANY ways to go about this:

-WCF Data Services to expose the data, and consume in ASP.NET

-Page methods to expose the data, separate method to update the data

-I'd rather avoid the UpdatePanel because I'm really looking for a full hands-on approach, with learning client side scripting being an objective as well.

Beyond that, it seems that one can use jQuery to build clientside templates, but also one can use the ASP.NET AJAX template engine (in ASP.NET 4.0 I believe).

A concern I have: users should only be able to work with the data exposed via these endpoints if they are logged into the website. Hopefully I can somehow reuse the ASP.NET forms authentication cookie for this purpose. 

Well, I hope I've posted enough to a

Design Patterns: Solidify Your C# Application Architecture with Design Patterns


A design pattern can solve many problems by providing a framework for building an application. Design patterns, which make the design process cleaner and more efficient, are especially well-suited for use in C# development because it is an object-oriented language. Existing design patterns make good templates for your objects, allowing you to build software faster. This article describes several popular design patterns you can use in your own applications, including the singleton, the decorator, the composite, and the state classes, which can improve the extensibility of your applications and the reuse of your objects.

Samir Bajaj

MSDN Magazine July 2001

Book review: Patterns of Enterprise Application Architecture

   Lately I finished reading the famous patterns book by Martin Fowler - Patterns of Enterprise Application Architecture. This book introduces and describes design patterns you will usually see when building enterprise applications. There are also examples for patterns and although they are simple and primitive they give you the idea how to implement or use specific patterns. If you are working on enterprise applications every day you will find this book very useful and I'm sure you will use it as manual. Yes, you can read this book as any other book and you can also use it as manual. In the end of this review you can find table of patterns with links to short introduction for each pattern. Are these patterns platform specific somehow? No, they are not. It doesn't matter what platform or language you are using. Of course, you must know your platform well because some of problems solved in this book maybe also already solved on platform you are working on. Don't try to push all available patterns to your application - use patterns of this book when you face problems that your tools doesn't solve or that your tools solve poorly. Of course, you can consult with this book if you are not sure how to implement one or another pattern in your application. My suggestion is to read this book with two other books (of course, there are more recommended books but le

SQL 2005 Express to work with C# in a distributed architecture


Hi, I am super new using SQL Srv 2005, I have been using for years Access 2003 and everyone is pointing me to better use SQL Server 2005 for many reasons. I haven't had any problem until now using Access2003 and I am using a distributed application developed in C# that basically uses the Access2003 file that is located in a shared folder in the LAN. However, I think it is worth to learn SQL Srv 2005 and more if there is a free version (Express).


I already have a deployed C# application that is using an MSAccess2003 that is located in a shared folder in the LAN (around 30 computers already have this application connected to the same LAN, of course), I am planning to install in the server the SQL Srv 2005 and use it.


Could I have more than one application connected to SQL Server 2005 Express edition at the same time? (<- since it is free, I have my questions about this scenario)




Repository Pattern Question. Confused need help.



I been reading Repository Pattern implementation for MVC 2. I am confused due to few things.

Simple Implementation is below.

Tables : Contact has One to Many relation with AssignToCategories
1 - Contacts
2 - AssignToCategories

I have in Model folder


My Questions

1 - We can use ContactRepository directly in View. Why we need IContactRepository for. As long as I know its for Test. Am I right?. If not than whats the purpose.
2 - I have seen ContactService, IContactService. As for as I know its for Business logic. Is there more to it?
3 - Contact has relation to AssignToCategories. Should I put all the data reterival logic within ContactRepository or this AssignToCategories need to have separate Repository and Interface.

I need some help with the concept. Though I have done alot of reading but still confused.

There is one layer called Pipe and filter. Whats the used of that?


html/javascript (jQuery)/ajax patterns question


My presentation layer (UI) will consist of pure html (no webforms) javascript, jquery making calls to (Ajax enabled) WCF services. can I use MVC (in my presentation layer) in this context or not?


Sharepoint Service Applications question, architecture



I read an article in documentation:

When for example u want to use service applications you need to connect your service
applications to the WFE’s. This is done using a proxy (don’t think WCF/ASMX proxy… think of it
in the more generic term for now (as compared to 2007)).

I donnt exactly undestand this - so what is this proxy and what is communication Protocol between WFE and the application server?

Second question is if it is truth, then if there are two farms or more then could you search content through all of them using one Search Service Application? And would it be enough to have ONE search server in total and on the other farm there would be only some proxy to search sevice?

Question regarding WCF Architecture



I am designing the application architecture for an application that will be primarily web based, but that at some point may want to expose certain functions to other clients via a web service.  I have developed a rough prototype and have some questions about the architecture.   Currently I am using the model shown below utilizing an ASMX web service.  We will eventually use WCF, but to keep it simple for the time being I am using ASMX. 

<WebMethod()> _
    Public Function checkuser(ByVal UserName As String) As Boolean
        Dim ibool As Boolean
        ibool = False
        ibool = checkUserExists(UserName)
        Return ibool
    End Function

You will notice that the function above calls another function which is located in a separate class in my APP_CODE folder that function is shown below:

Public Shared Function checkUserExists(ByVal strUserName As String) As Boolean
        Dim objcontext As New MyModel.SystemEntities
        Dim boolValid As Boolean
        Dim objUser = From a In objcontext.logins Where a.User_ID = strUserName
        If objUser.Count > 0 Then
            boolValid = True
            boolValid = False
        End If
        Return boolValid
    End Function

Would it be better if I just moved the cont

3 tier architecture : question


I have a customer table : firstname , lastname.

i have customer class: fisrtname. lastname. 


In three tier architecture, if i authenticate the custmoer using firstname and lastname. 

deafault.aspx: i use form with two textboes for firstname and lastname. 

default.aspx.cs: on click of  a button in i assign the text boxes values to set properties of firstname and lastname of customer.cs class 

i have a event handler in custmer clas to pass the object to customer DA class. 

the  DA class check the validity in the customer table. and allows access.


This is my understanding of n tier architecture. 

The question: 

If i add few more columns later to customer table. if i need to use them for authentication, i have to add in all layers. 

Is there any approach where in this situation is taken care of?

I am beginner to asp.net.

Architecture and Design Patterns



 What is the difference between Architecture and Design patterns ? Can anyone please classify them. ?

I m so confused. Don't think as a stupid question


Architecture Tools in VSTS 2010

Designing new functionality on existing applications can be daunting. There are always differences between the original design and the current implementation.

The new Architecture tools within Visual Studio Team System 2010 help you understand the application you have, design new functionality you need, and validate that your design and your implementation do not deviate.

Unit Testing SharePoint - Past, Present, and Sporm

As I described in SharePoint: The Wild West of Software Development there is a serious problem when you develop for SharePoint: ensuring quality through unit testing is really, really hard. And that's where a new open source tool just released today called sporm (SharePoint Object Relational Mapper) comes in. While sporm provides many benefits besides simplified unit testing I wanted to focus on this topic first, because sporm's approach, which models the entity framework in the way it supports POCO's, is a unique feature not available with other SharePoint tools like LINQ to SharePoint.

SharePoint Tutorial - SharePoint Logical Architecture

The SharePoint logical architecure consists of nested and isolated levels. These levels provide benefits for security, navigation, search, branding and ect. depending on the level

SharePoint Farm
The base level for any SharePoint implementation is the SharePoint farm. Physically a farm can consist of one server or many servers. An organization may implement one or more farms. This usually depends on security and performance needs.

SharePoint Tutorial -SharePoint Physical Architecture

The SharePoint physical architecture consists of services running on one or more servers.

There are three types of services that together run the SharePoint farm: web, application and database services. Web services through Internet Information Server is what processes the ASP.Net and sends back the html to a user's browser. Application services is where the "brains" of SharePoint are located. All of the SharePoint specific logic and services are processed there. Database services are run by SQL Server and it's where all the data/content for SharePoint is stored.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend