.net - Overriding Save method or adding Saving event with EF4 -


whats easy (less code) way add business logic 'code first' model execute before saved database?

e.g. given albums model music store example

public class album {     public string title { get; set; }     public genre genre { get; set; }      public datetime lastupdated { get; private set;} } 

e.g. if add lastupdated property example, how can ensure it's automatically set if entity updated - perhaps on save using someting like

private void album_onsave() {    this.lastupdated = datetime.now; } 

lastupdated has part of model. making sure property date use repository , functions insert or update album should set lastupdated.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -