monitor-table-change-with-sqltabledependency icon indicating copy to clipboard operation
monitor-table-change-with-sqltabledependency copied to clipboard

Nested object

Open GrazDeKa opened this issue 3 years ago • 0 comments

Hi if I have a class

public Class1 { string prop1{get; set;} string prop2{get; set;} Class2 prop3{get; set;} }

public Class2 { string prop1{get; set;} string prop2{get; set;} }

Then I set the mapper as:

mapper = new ModelToTableMapper<Class1>(); mapper.AddMapping(model => model.prop1, column[0]); mapper.AddMapping(model => model.prop2, column[1]); mapper.AddMapping(model => model.prop3.prop1, column[2]); mapper.AddMapping(model => model.prop3.prop2, column[3]);

and the sqldependency as dependency = new SqlTableDependency<Class1>(ConnectionString, TableName, mapper: mapper);

With this code it tracks only the changes in the simple properties of Class1 (prop1, prop2) while it doesn't track changes of the properties of class 2 (prop3.prop1, prop3.prop2). I think this is related to the nested object. Is there a way to avoid this?

GrazDeKa avatar Sep 30 '21 15:09 GrazDeKa