From 0f6d30eb6a003eee2ebc3008a45170e0c2bb8cdd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 15 Nov 2018 12:50:03 +0200 Subject: Optimized accuracy of CSV recordings! --- .../Templates/EntityCodeFile.cshtml | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/Tango.CodeGeneration') diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml index 2231c30f1..daa4e7d51 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml @@ -32,6 +32,16 @@ namespace Tango.BL.Entities [Table("@(Model.TableName)")] public partial class @(Model.Name) : ObservableEntity<@(Model.Name)> { + @foreach (var prop in Model.Fields) + { + if (!prop.Name.EndsWith("Guid")) + { +
+ public event EventHandler<@(prop.Type)> @(prop.Name)Changed; +
+ } + } + @foreach (var prop in Model.Fields) {
@@ -59,7 +69,20 @@ namespace Tango.BL.Entities public @(prop.Construct || prop.Complex ? "virtual" : "") @(prop.Type) @(prop.Name) { get { return _@(prop.Name.ToLower()); } - set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); } + set + { + if (_@(prop.Name.ToLower()) != value) + { + _@(prop.Name.ToLower()) = value; + @if (!prop.Name.EndsWith("Guid")) + { +
+ @(prop.Name)Changed?.Invoke(this, value); +
+ } + RaisePropertyChanged(nameof(@(prop.Name))); + } + } }
} -- cgit v1.3.1