aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration')
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs36
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs2
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs15
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj4
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml25
5 files changed, 59 insertions, 23 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs b/Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs
new file mode 100644
index 000000000..873aabe1e
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/DbPropertyExtensionModel.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.CodeGeneration
+{
+ public class DbPropertyExtensionModel
+ {
+ public String Description { get; set; }
+ public double Min { get; set; }
+ public double Max { get; set; }
+ public String StringFormat { get; set; }
+
+ public bool HasDescription
+ {
+ get { return Description != null; }
+ }
+
+ public bool HasRange
+ {
+ get { return Min != Max; }
+ }
+
+ public bool HasStringFormat
+ {
+ get { return StringFormat != null; }
+ }
+
+ public DbPropertyExtensionModel()
+ {
+ StringFormat = "0.0";
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs
index 24d61bb0a..8126c8bc4 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs
+++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs
@@ -66,7 +66,7 @@ namespace Tango.CodeGeneration
public String DbDescription { get; set; }
- public RangeDescriptionModel RangeDescription { get; set; }
+ public DbPropertyExtensionModel PropertyExtension { get; set; }
public bool IsForeignKey { get; set; }
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs b/Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs
deleted file mode 100644
index 4600460b7..000000000
--- a/Software/Visual_Studio/Tango.CodeGeneration/RangeDescriptionModel.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.CodeGeneration
-{
- public class RangeDescriptionModel
- {
- public String Description { get; set; }
- public double Min { get; set; }
- public double Max { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
index 6bff5b42e..4c2793367 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
@@ -77,7 +77,7 @@
<Compile Include="ProtoEnumFile.cs" />
<Compile Include="ProtoMessageFile.cs" />
<Compile Include="ProtoProperty.cs" />
- <Compile Include="RangeDescriptionModel.cs" />
+ <Compile Include="DbPropertyExtensionModel.cs" />
<Compile Include="TangoDAOJavaFile.cs" />
<Compile Include="EnumerationFileJava.cs" />
<Compile Include="EnumerationFile.cs" />
@@ -129,7 +129,7 @@
<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/EntityCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml
index 950e24f79..780cc2647 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml
@@ -19,6 +19,7 @@ using System.Linq;
using Tango.DAL.Remote.DB;
using Tango.Core;
using System.ComponentModel;
+using Tango.Core.CustomAttributes;
namespace Tango.BL.Entities
{
@@ -67,12 +68,26 @@ namespace Tango.BL.Entities
@(prop.IsForeignKey ? "[ForeignKey(\"" + prop.ForeignKeyName + "\")]" : "")
@(prop.XmlIgnore ? "[XmlIgnore]" : "")
@(prop.XmlIgnore ? "[JsonIgnore]" : "")
- @if (prop.RangeDescription != null)
+ @if (prop.PropertyExtension != null)
{
- <div>
- [Description("@(prop.RangeDescription.Description)")]
- [Range(@(prop.RangeDescription.Min),@(prop.RangeDescription.Max))]
- </div>
+ if (prop.PropertyExtension.HasDescription)
+ {
+ <div>
+ [Description("@(prop.PropertyExtension.Description)")]
+ </div>
+ }
+ if (prop.PropertyExtension.HasRange)
+ {
+ <div>
+ [Range(@(prop.PropertyExtension.Min),@(prop.PropertyExtension.Max))]
+ </div>
+ }
+ if (prop.PropertyExtension.HasStringFormat)
+ {
+ <div>
+ [StringFormat("@(prop.PropertyExtension.StringFormat)")]
+ </div>
+ }
}
public @(prop.Construct || prop.Complex ? "virtual" : "") @(prop.Type) @(prop.Name)
{