IsNemoEqualTrue / monitor-table-change-with-sqltabledependency

Get SQL Server notification on record table change
MIT License
655 stars 177 forks source link

Nested object #236

Open GrazDeKa opened 3 years ago

GrazDeKa commented 3 years ago

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(); 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(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?