aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2017-12-10 11:18:02 +0200
committerAvi Levkovich <avi@twine-s.com>2017-12-10 11:18:02 +0200
commitf8c0a7d42104cf01ef6c3b0d51503a91ee0d7047 (patch)
treeaa28e09c5d4c4a7da8e5fe5e00ffe355f6fc5a3f /Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml
parent8eec69d8933841f4e45fd9e63010bff51ae64a27 (diff)
parent9a34f6f6456702440ecd50f902e59daa2ea77595 (diff)
downloadTango-f8c0a7d42104cf01ef6c3b0d51503a91ee0d7047.tar.gz
Tango-f8c0a7d42104cf01ef6c3b0d51503a91ee0d7047.zip
MERGE.
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml')
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml61
1 files changed, 61 insertions, 0 deletions
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)
+ {
+ <div>
+ private @(prop.Type) _@(prop.Name.ToLower());
+ /// <summary>
+ /// Gets or sets the @(Model.Name.ToLower()) @(prop.Description).
+ /// </summary>
+ [EntityFieldName("@(prop.FieldName)")]
+ public @(prop.Type) @(prop.Name)
+ {
+ get { return _@(prop.Name.ToLower()); }
+ set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); }
+ }
+ </div>
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="@(Model.Name)" /> class.
+ /// </summary>
+ public @(Model.Name)() : base()
+ {
+ Init();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="@(Model.Name)" /> class.
+ /// </summary>
+ /// <param name="entity">The entity.</param>
+ public @(Model.Name)(@(Model.TableName) entity) : base(entity)
+ {
+ Init();
+ MapEntityToObservable(entity, this);
+ }
+
+ /// <summary>
+ /// Initialize complex types.
+ /// </summary>
+ private void Init()
+ {
+ @foreach (var prop in Model.Fields)
+ {
+ if (prop.Construct)
+ {
+ <div>
+ @(prop.Name) = new @(prop.Type)();
+ </div>
+ }
+ }
+ }
+ }
+}