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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:14:38+00:00 2026-05-31T08:14:38+00:00

I am currently developping an application which object model and persistence layer is built

  • 0

I am currently developping an application which object model and persistence layer is built using the Entity Framework model designer.

One of the requirements I have is to provide a status to my entities that could let me know whenever they are in a “dirty” state (modified), when the status change occurs and, most important, working in a disconnected mode. So I started modifying the T4 template to add a IsDirty boolean property upon generation of those entities, added an event that is fired whenever IsDirty changes and added this.IsDirty = true in the xxxChanged methods of all scalar properties.

Everything works great when the entity is not attached to its context but when attached, whenever a property is changed, thus changing the IsDirty value to false, I receive this exception:

The property ‘IsDirty’ does not have a valid entity mapping on the
entity object. For more information, see the Entity Framework
documentation.

So what am I doing wrong here? I don’t want this property to be mapped in my database as it is just an object status that only matters when the object is “alive”. Is there an attribute I should use to decorate the IsDirty property? Or should I derive EntityObject and implement the status mechanism? Or maybe you have any better advice on how to implement this?

Thanks.


Edit: I am using Entity Framework 4.0 with EDM designer.

Here is the piece of code generated into every base entity:

private bool isDirty;   
public event EventHandler DirtyStatusChanged;

public bool IsDirty
{
    get
    {
        return this.isDirty;
    }

    internal set
    {
        if (this.isDirty != value)
        {
            ReportPropertyChanging("IsDirty");
            this.isDirty = value;
            ReportPropertyChanged("IsDirty");
            ReportDirtyStatusChanged();
        }
    }
}

protected void ReportDirtyStatusChanged()
{
    var handler = this.DirtyStatusChanged;

    if(handler != null)
    {
        handler(this, EventArgs.Empty);
    }
}
  • 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-31T08:14:40+00:00Added an answer on May 31, 2026 at 8:14 am

    I finally found the error myself. The problem lied inside my property setter. Instead of calling ReportPropertyChanged/ing I should have called OnPropertyChanged/ing.

    ReportPropertyChanged/ing implies for the context to search for changes between the original and the current entity value but as this property is just a status object that has no mapping to a store, the concept of original value makes no sense, thus making the context failing to find a correct mapping for this property.

    Using OnPropertyChanged/ing just fixed it.

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

Sidebar

Related Questions

I'm currently developping an application in java using Hibernate as a persistence manager and
I'm currently developping an Android application which connects to a server through TCP. The
I'm currently developing a web application using Struts2 framework. This application requires to dynamically
Currently, I am developing an application which domain model should prevent objects duplication according
I'm developing an application which currently have hundreds of objects created. Is it possible
I am currently developing an application which will require multiple different development languages. I
I am currently developing an application, which gets the input from a text file
I'm currently involved with developing a C# CMS-like web application which will be used
I'm currently developing a cross-platform C application. Is there any compiler macro which is
I'm developing non-interactive cpu-bound application which does only computations, almost no IO. Currently it

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.