How to create custom get and set methods for Linq2SQL object
        Posted  
        
            by optician
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by optician
        
        
        
        Published on 2010-04-27T15:40:01Z
        Indexed on 
            2010/04/27
            15:43 UTC
        
        
        Read the original article
        Hit count: 418
        
I have some objects which have been created automatically by linq2SQL.
I would like to write some code which should be run whenever the properties on these objects are read or changed.
Can I use typical get { //code } and set {//code } in my partial class file to add this functionality? Currently I get an error about this member already being defined.
This all makes sense.
Is it correct that I will have to create a method to function as the entry point for this functionality, as I cannot redefine the get and set methods for this property.
I was hoping to just update the get and set, as this would mean I wouldn't have to change all the reference points in my app. But I think I may just have to update it everywhere.
© Stack Overflow or respective owner