Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6689725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:33:11+00:00 2026-05-26T05:33:11+00:00

I am designing an ASP.NET MVC3 application, and I would like to have a

  • 0

I am designing an ASP.NET MVC3 application, and I would like to have a clear separation of concerns in a 3 layer architecture. I am using Fluent NHibernate as the ORM, the Repository pattern to work with the entities mapped by NHibernate. I would like to add a proper business layer with a Unit Of Work pattern, keeping the MVC portion only for presentation (by using ViewModels that map to the nHibernate entities through the business layer). This article describes the combined 3-tier and MVC architectures nicely.

According to this MVC + unit of work + repository article I don’t see a clear distinction of a business layer. The unit of work class presents strongly typed getters for each repository type, which looks appropriate for a business layer. However, it exposes a Save method, which I think would translate to BeginTransaction and CommitTransaction methods with nHibernate. This begs some questions:

1) Is exposing transaction control to MVC a good idea? At which stage should transaction control happen? Seems to me that MVC should not be responsible for transactions, but how to avoid that?

2) Should there be some automatic way to handle transactions? This ActionFilter implementation is semi-automatic but the transaction control is clearly in the MVC section, which is not the business layer.

3) Is the UnitOfWork class the same as a business layer class?
– if so, does that mean that we can add custom business logic methods into it?
– if not, do we wrap the unit of work with some other class(es) that contains business logic methods?

I appreciate any ideas or examples. Thank you.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:33:11+00:00Added an answer on May 26, 2026 at 5:33 am

    First of all I want to clarify a little mis-conception about the business layer, as you want to use the Repository pattern and your setup is a candidate to Domain Driven Design, then the business layer is actually [the Domain Model (Entities and Value Objects where you design your business logic in an object oriented fashion in entities and objects) , and Application Layer to co-ordinate transactions and operations and commands to the domain layer], so the suggested architecture would be something like this:

    • Presentation (MVC) [OrderView, OrderPresentationModel, OrderController]
    • Application [OrderService]
      • Use UnitOfWork (Transactions) and Repositories to execute domain logic
      • DTOs [OrderDTO, CustomerDTO]
    • Domain
      • Entities and Value Objects [Order, Customer, LineItem, Address]
      • Repository Interfaces [IOrderRepository, ICustomerRepository]
      • (optional) Unit of Work Interface [IUnitOfWork]
    • Infrastructure.DataAccess (Using ORM or Data Access Technology)
      • Repositories [OrderRepository, CustomerRepository]
      • (optional) Unit of Work [UnitOfWork]
    • Infrastructure.Common
      • Logging
      • Utilities

    Example scenario:

    [Presentation] OrderController:

     _orderService.CreateOrder(OrderDTO);
    

    [Application] OrderService:

     _unitOfWork.BeginTransaction();
     var customer = _customerRepository.GetById(orderDTO.CustomerId);
     var order = new Order() { Customer=customer, Price=orderDTO.Price, ... }
     _orderRepository.Add(order);
     _unitOfWork.Commit();
    

    About your questions:

    1) Is exposing transaction control to MVC a good idea? At which stage should transaction control happen? Seems to me that MVC should not be responsible for transactions, but how to avoid that?

    No, i would prefer to separate it in application layer in order to make design flexible to support different presentations.

    2) Should there be some automatic way to handle transactions? This ActionFilter implementation is semi-automatic but the transaction control is clearly in the MVC section, which is not the business layer.

    Use transactions in application layer.

    3) Is the UnitOfWork class the same as a business layer class?
    – if so, does that mean that we can add custom business logic methods into it?
    – if not, do we wrap the unit of work with some other class(es) that contains business logic methods?

    No, it is just a way to group tasks into transactions.
    The business logic actually is encapsulated in entities and if the logic is not related to one entity it should be implemented in domain services [TransferService.Transfer(account1, account2, amount)], for co-ordinations, accessing repositories, and transactions the application layer is the place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am designing a web application using the ASP.net MVC framework. I would like
I'm using the ASP.NET MVC3 sample project and would like to have new links
I have a telerik grid in an asp.net mvc3 (RAZOR) View. While designing I
I'm writing an ASP.net MVC3 application using Entity Framework Code First and SqlCe4. I
i am designing a project in asp.net mvc3, i have designed database in sql
I am designing a project in asp.net mvc3, i have designed my database in
I have Finished Designing my first Crystal Report using ASP.NET, I am Providing user
I have been using Asp.Net for designing web applications recently and was wondering if
I am designing a File Server application in ASP.NET. I have to upload a
I'm designing an ASP.NET application that must support 'SubSites'. The idea is to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.