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 7651431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:30:16+00:00 2026-05-31T11:30:16+00:00

I am busy reading, and enjoying, Dependency Injection in .Net by Mark Seemann. It

  • 0

I am busy reading, and enjoying, Dependency Injection in .Net by Mark Seemann.

It is quite difficult for me to explain the exact context, so please only bother with this question if you are familiar with the book.

My question has to do with the two Product classes in chapter 2 pg 49. There is one in the Domain layer and one in the data access layer. It is explained that Product class in the data access layer was created by the Linq to Entity wizard.

I am working with Linq to SQL, and I could adorn my model class with Ling to SQL attributes, so that I don’t have to have a second class. E.g.

[Table(Name="Customers")]
public class Customer
{
  [Column(IsPrimaryKey=true)]
  public string CustomerID;
  [Column]
  public string City;
}

However I feel this is mixing concerns and it will in effect tightly couple my domain layer to the Linq to SQL data access layer. Do you agree with this?

Let’s assume I create two ‘Customer’ classes, for the domain and data access layer. Let’s say City is a required field. When saving, this rule needs to be checked. Should this be done in the domain layer or the data access layer, or both?

Thanks, Daryn

  • 1 1 Answer
  • 0 Views
  • 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-31T11:30:18+00:00Added an answer on May 31, 2026 at 11:30 am

    Absolutely, that couples your domain layer to the DAL. Even worse, your domain layer entities will have the same structure as the tables in your DB. If those tables are relational, then that won’t be the best representation of a domain model.

    What we do is let the Linq-to-SQL entities exist in the DAL, and then we have mapping classes in the DAL convert the L2S entities to domain entities, and vice versa. And that’s okay, because the DAL really is your ORM, and part of it’s job is to do this mapping.

    I would say that if City is required, as a business rule, then that’s business logic and belongs as a business rule in the business logic layer. There are validation packages out there that can help with this issue.

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

Sidebar

Related Questions

I am in the Console environment busy reading all the rows from a table
While I'm busy here reading the FastCGI documentation (yeah, reading the 'friendly' manual), does
I'm currently busy coding a hangman game in VB.NET. As a wordlist, I have
I'm quite busy with working with the Zend_Form object. I'm building a form which
I am busy building an application in which I am reading data from more
I am busy learning ASP.Net MVC and so I recently installed MVC 4 on
Busy working on Visual Studio 2010 Express for Windows phone and is wanting to
Im busy with my app and i walked in some problems when i click
I am busy creating a less complicated version of NinePatchDrawable that tiles the inner
I am busy writing an dynamic AND filter on a IQueryable Linq object, so

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.