none
Future of Domain models RRS feed

  • Question

  • I use linQ to Sql and put all my tables into a datacontext class.

    But I am not sure about how am I going to implement new methods on my database <Table > objects.

    Should I inherit from them or should I write a partial class for that ?

    I wanna be able to construct a domain model using the DlinQ, does anybody have an experience about that?
    Sunday, April 29, 2007 3:10 PM

Answers

  • I think that you need to be wary of structuring your Domain Model (http://udidahan.weblogs.us/2007/04/21/domain-model-pattern/) after the tables in your database. I find that a different structure arises when complex business rules are handled. What this means is that if you need to control your Domain Model fully, LINQ might be a bit problematic, yet many of the other O/R Mapping tools now let you query using LINQ, so that's a nice middle ground.

     

    Monday, April 30, 2007 11:46 AM

All replies

  • The easiest way to create a domain model with LINQ to SQL is to add a LINQ library project to your solution. Then add a DLinqObjects item to this library project. Bring up the designer and define your data model classes either by dragging DLinq Objects or by dragging and dropping tables and views directly from the server explorer onto the designer surface. The generated classes are defined as partial classes so you can add additional validation, properties and business logic.

     

    Creating an effective domain model is a bit different from what I describe above. You'll find useful principles and best practices for creating domain models in the book Domain-Driven Design by Eric Evans. Applying Domain-Driven Design and Patterns by Jimmy Nilsson focuses more on the implementation perspective.

    Monday, April 30, 2007 11:33 AM
  • I think that you need to be wary of structuring your Domain Model (http://udidahan.weblogs.us/2007/04/21/domain-model-pattern/) after the tables in your database. I find that a different structure arises when complex business rules are handled. What this means is that if you need to control your Domain Model fully, LINQ might be a bit problematic, yet many of the other O/R Mapping tools now let you query using LINQ, so that's a nice middle ground.

     

    Monday, April 30, 2007 11:46 AM
  • The use of DataSets in .NET is often a sign of the Anemic Domain Model Anti-Pattern

     

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

     

    do u think that's curse that  LinQ will have ?

    Tuesday, May 1, 2007 11:48 AM