From 3e665934f3f01b2cdd3de3fbc2c03ae27ac5740e Mon Sep 17 00:00:00 2001 From: Roy Date: Wed, 6 Dec 2017 10:11:45 +0200 Subject: Moved ExtendedObject & RelayCommand to Core. CodeGeneration EntityCodeFile working + cycle reference! --- .../Templates/EntityCodeFile.cshtml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml (limited to 'Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml') diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml new file mode 100644 index 000000000..301b9f58c --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Tango.DAL.Remote.DB; + +namespace Tango.DAL.Remote.ObservableEntities +{ + public class @(Model.Name) : ObservableEntity<@(Model.TableName)> + { + @foreach (var prop in Model.Fields) + { +
+ private @(prop.Type) _@(prop.Name.ToLower()); + /// + /// Gets or sets the @(Model.Name.ToLower()) @(prop.Description). + /// + [EntityFieldName("@(prop.FieldName)")] + public @(prop.Type) @(prop.Name) + { + get { return _@(prop.Name.ToLower()); } + set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); } + } +
+ } + + /// + /// Initializes a new instance of the class. + /// + public @(Model.Name)() : base() + { + Init(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The entity. + public @(Model.Name)(@(Model.TableName) entity) : base(entity) + { + Init(); + MapEntityToObservable(entity, this); + } + + /// + /// Initialize complex types. + /// + private void Init() + { + @foreach (var prop in Model.Fields) + { + if (prop.Construct) + { +
+ @(prop.Name) = new @(prop.Type)(); +
+ } + } + } + } +} -- cgit v1.3.1