Take the 2-minute tour ×

I have an entity. I'm mostly manipulating this entity via a databound form, although I did trap the PreSave event in the ObjectModel class to inject a few audits. 99% of this works perfectly fine, including the "DateModified" audit column that I'm using.

But there are two audits that are also put onto the model object- "ModifiedBy" and "Usable" (a true/false value based off a business rule). I can set both of those successfully on the entity. I can confirm that they propagate all the way down to the PreSave event handler. I can confirm that no subsequent saves are blowing out those values or anything.

But it doesn't work. Neither of those columns actually get saved. The DateModified column, on the other hand, does get updated, every time.

For Each m In mattersToValidate.Where(Function(mm) Not mm Is Nothing)
        m.DateModified = Now() 'works
        m.CSCRecentAdd = False 'works
        Debug.Assert(m.ModifiedBy = "DOMAIN\USER") 'My user name- this is true (the value actually comes from a databound control, but this Assert passes, despite the value not reaching the DB).
        m.ValidMatter = m.Validation 'doesn't work
        If m.LawSection.LawSectionName = CLAIMABLE Then
            m.ClaimNumber = m.MatterID 'works
            m.ClaimNumber = Nothing
        End If

I should add that the entity points directly at the database table, and is not going through a view or SP or anything else.

share|improve this question
How are your ModifiedBy and Usable properties configured in the entity model? –  Ladislav Mrnka May 6 '11 at 13:19
They're using the default settings that the model set- concurrency mode is none, no default value, it is neither an entity key nor fixed length, it has public getters and setters. The settings are exactly the same for every column in the model. –  Remy Porter May 6 '11 at 14:45
So you are not using store generated pattern? –  Ladislav Mrnka May 6 '11 at 15:02
Not for that column, no. I am using store generated for the primary key- I should have been more specific in my previous comment. But not for any of these columns. –  Remy Porter May 6 '11 at 15:31
add comment


Your Answer



Browse other questions tagged or ask your own question.