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

  • Home
  • SEARCH
  • 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 4119846
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:08:36+00:00 2026-05-20T23:08:36+00:00

I have a domain model with these two entities : Parts and Contracts. a

  • 0

I have a domain model with these two entities :

Parts and Contracts.

a Contract has multiple parts, and a part might belong to many contracts.

I represent it this way :

 class Contract 
 {
    ICollection<Part> Parts{get;set;}
    DateTime LastModifiedDate{get;set;}
 }

 class Part
 {
    ICollection<Contract> Parts{get;set;}
 }

Every time a Part on a contract is changed, the LastModifiedDate of the contract has to reflect the date at which the change occured.

which way is the better way to handle this ? :

1 -using database triggers

(this allows me to catch modifications that are made to parts without the modification having to be made through my application)

2 -or using the model in such a way that whenever a change is made at the part level, I manually change the contract’s LastModifiedDate ?

3 -Is there a 3rd way that would allow to use both ways of doing things ?

4 -Is there anything else I’m missing ?

N.B : I’m using Entity Framework CTP4 for DB layer.

  • 1 1 Answer
  • 3 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-20T23:08:36+00:00Added an answer on May 20, 2026 at 11:08 pm

    I’m much more familiar with NHibernate than entity-framework, but the usual way to do this is with event handling: you register a delegate to run before the object is saved and use this delegate to update the metadata.

    You could create an interface named IHasUpdatedDate if you end up with multiple classes with such metadata. In my projects all my entities have WhenUpdated & WhenCreated fields.

    It seems like entity framework does support event handling:

    http://msdn.microsoft.com/en-us/library/cc716714.aspx

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

Sidebar

Related Questions

I have two domain classes: Contract and Orgainisation . A contract has one contractor
I have two entities in my domain model: public class Configuration : DomainEntity {
I have two tables that are considered a single entity in my domain model.
I have created domain model and define entities, value objects, Services and so on.
I have a domain model that has the concept of an Editor and a
I have two entities Foo and Bar with a Many to Many relationship between
I have a domain model that contains member variables for two languages, something like
Let's say i have a Domain Model that im trying to make compatible with
In Grails 1.3.7, I have a domain model like this: abstract class A {
Quick background: I'm programming in PHP, I have a domain model with a separate

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.