aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-02-23 20:15:36 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-02-23 20:15:36 +0200
commit17612c08da93c75d4c941a643bc7602c18f351d8 (patch)
tree7fb879ef52d5460149b199f752279c3889cb5271 /Software/Visual_Studio/Tango.CodeGeneration
parentd7c8a8e9a6320ade6098e0d8e182c7ada4e30a97 (diff)
downloadTango-17612c08da93c75d4c941a643bc7602c18f351d8.tar.gz
Tango-17612c08da93c75d4c941a643bc7602c18f351d8.zip
Implemented auto DTO generation.
Implemented mapping of DTO <=> Observables. Organization of unit tests. Removed DELETED from ADDRESS & CONTACT.
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration')
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Class.cs5
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs5
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/EntityDTOCodeFile.cs19
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/EntityInheritedDTOCodeFile.cs23
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Property.cs5
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj6
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityDTOCodeFile.cshtml44
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityInheritedDTOCodeFile.cshtml24
8 files changed, 125 insertions, 6 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Class.cs b/Software/Visual_Studio/Tango.CodeGeneration/Class.cs
index 6f1f4f3b9..5a8ea1e74 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Class.cs
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Class.cs
@@ -17,6 +17,11 @@ namespace Tango.CodeGeneration
/// </summary>
public String Name { get; set; }
+ /// <summary>
+ /// Gets or sets the description.
+ /// </summary>
+ public String Description { get; set; }
+
public List<String> InheritsFrom { get; set; }
/// <summary>
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs
index 9216f5c29..958754a60 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs
+++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs
@@ -28,11 +28,6 @@ namespace Tango.CodeGeneration
public List<EntityCodeFileField> Fields { get; set; }
/// <summary>
- /// Gets or sets the description.
- /// </summary>
- public String Description { get; set; }
-
- /// <summary>
/// Initializes a new instance of the <see cref="EntityCodeFile"/> class.
/// </summary>
/// <param name="name">The code file name.</param>
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityDTOCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityDTOCodeFile.cs
new file mode 100644
index 000000000..eb97dcd90
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityDTOCodeFile.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.CodeGeneration
+{
+ /// <summary>
+ /// Represents a database entity DTO code file.
+ /// </summary>
+ /// <seealso cref="Tango.CodeGeneration.Class" />
+ public class EntityDTOCodeFile : Class
+ {
+ public String ObservableType { get; set; }
+
+ public String InheritedType { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityInheritedDTOCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityInheritedDTOCodeFile.cs
new file mode 100644
index 000000000..297050d69
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityInheritedDTOCodeFile.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.CodeGeneration
+{
+ /// <summary>
+ /// Represents a database entity DTO code file.
+ /// </summary>
+ /// <seealso cref="Tango.CodeGeneration.Class" />
+ public class EntityInheritedDTOCodeFile : Class
+ {
+ public String BaseClass { get; set; }
+
+ public EntityInheritedDTOCodeFile(String name, String baseClass)
+ {
+ Name = name;
+ BaseClass = baseClass;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Property.cs b/Software/Visual_Studio/Tango.CodeGeneration/Property.cs
index d7ca5f4a8..cb27ca2a4 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Property.cs
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Property.cs
@@ -23,6 +23,11 @@ namespace Tango.CodeGeneration
public String Type { get; set; }
/// <summary>
+ /// Gets or sets the property description.
+ /// </summary>
+ public String Description { get; set; }
+
+ /// <summary>
/// Gets or sets the property setter modifier.
/// </summary>
public CodeObjectModifier SetterModifier { get; set; }
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
index 98c063a86..a3b02afd5 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
@@ -65,6 +65,8 @@
<Compile Include="CodeObject.cs" />
<Compile Include="CustomResolver.cs" />
<Compile Include="DpProperty.cs" />
+ <Compile Include="EntityInheritedDTOCodeFile.cs" />
+ <Compile Include="EntityDTOCodeFile.cs" />
<Compile Include="EntityCodeFileJavaExtension.cs" />
<Compile Include="EntityCodeFileJava.cs" />
<Compile Include="EntityCodeFile.cs" />
@@ -120,11 +122,13 @@
<EmbeddedResource Include="Templates\ObservablesStaticCollectionsFile.cshtml" />
<EmbeddedResource Include="Templates\EntityInheritedCodeFile.cshtml" />
<EmbeddedResource Include="Templates\TangoWebClientCodeFile.cshtml" />
+ <EmbeddedResource Include="Templates\EntityDTOCodeFile.cshtml" />
+ <EmbeddedResource Include="Templates\EntityInheritedDTOCodeFile.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityDTOCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityDTOCodeFile.cshtml
new file mode 100644
index 000000000..7992aeb86
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityDTOCodeFile.cshtml
@@ -0,0 +1,44 @@
+@{
+ Tango.CodeGeneration.EntityDTOCodeFile model = Model as Tango.CodeGeneration.EntityDTOCodeFile;
+}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Tango Observables Generator
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated. Do not modify!
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+
+namespace Tango.BL.DTO
+{
+ @if (model.Description != null)
+ {
+ <div>
+ /// <summary>
+ /// @(model.Description)
+ /// </summary>
+ </div>
+ }
+ public abstract class @(model.Name) : ObservableEntityDTO<@(model.InheritedType), @(model.ObservableType)>
+ {
+ @foreach (var prop in model.Properties)
+ {
+ <div>
+ /// <summary>
+ /// @(prop.Description)
+ /// </summary>
+ public @(prop.Type) @(prop.Name) { get; set; }
+
+ </div>
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityInheritedDTOCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityInheritedDTOCodeFile.cshtml
new file mode 100644
index 000000000..2501b37d1
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityInheritedDTOCodeFile.cshtml
@@ -0,0 +1,24 @@
+@{
+ Tango.CodeGeneration.EntityInheritedDTOCodeFile model = Model as Tango.CodeGeneration.EntityInheritedDTOCodeFile;
+}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.BL.DTO
+{
+ @if (model.Description != null)
+ {
+ <div>
+ /// <summary>
+ /// @(model.Description)
+ /// </summary>
+ </div>
+ }
+ public class @(model.Name) : @(model.BaseClass)
+ {
+
+ }
+}