aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs37
1 files changed, 11 insertions, 26 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
index 208adf63f..3280f47f5 100644
--- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
@@ -53,7 +53,7 @@ namespace Tango.DBObservablesGenerator.CLI
String table_description = null;
var db_des = dbDescriptions.FirstOrDefault(x => x.TableName == table.Name);
- if (db_des != null && !String.IsNullOrWhiteSpace(db_des.TableDescription))
+ if (db_des != null)
{
table_description = db_des.TableDescription;
}
@@ -121,31 +121,24 @@ namespace Tango.DBObservablesGenerator.CLI
if (column_description != null)
{
- DbPropertyExtensionModel dbPropertyExtensionModel = null;
+ RangeDescriptionModel rangeDescription = null;
try
{
- dbPropertyExtensionModel = JsonConvert.DeserializeObject<DbPropertyExtensionModel>(column_description, new JsonSerializerSettings()
- {
- NullValueHandling = NullValueHandling.Ignore,
- MissingMemberHandling = MissingMemberHandling.Ignore,
- });
+ rangeDescription = JsonConvert.DeserializeObject<RangeDescriptionModel>(column_description);
}
catch { }
- if (dbPropertyExtensionModel != null)
+ if (rangeDescription != null && rangeDescription.Description != null)
{
- codeField.PropertyExtension = dbPropertyExtensionModel;
-
- if (dbPropertyExtensionModel.Description != null)
- {
- codeField.DbDescription = dbPropertyExtensionModel.Description.ToLines().Select(x => "/// " + x).Join(Environment.NewLine);
- }
+ codeField.RangeDescription = rangeDescription;
+ codeField.DbDescription = rangeDescription.Description.ToLines().Select(x => "/// " + x).Join(Environment.NewLine);
}
else
{
codeField.DbDescription = column_description.ToLines().Select(x => "/// " + x).Join(Environment.NewLine);
}
+
}
if (field.PropertyType.IsGenericType)
@@ -154,14 +147,6 @@ namespace Tango.DBObservablesGenerator.CLI
{
codeField.Type = String.Format("Nullable<{0}>", "DateTime");
}
- else if (field.PropertyType == typeof(Nullable<Int32>))
- {
- codeField.Type = String.Format("Nullable<{0}>", "Int32");
- }
- else if (field.PropertyType == typeof(Nullable<Double>))
- {
- codeField.Type = String.Format("Nullable<{0}>", "Double");
- }
else
{
codeField.Type = String.Format("SynchronizedObservableCollection<{0}>", DalNameToStandardName(field.PropertyType.GenericTypeArguments.Single().Name).SingularizeMVC());
@@ -199,7 +184,7 @@ namespace Tango.DBObservablesGenerator.CLI
}
codeFile.Fields.Add(codeField);
- if (field.PropertyType.IsPrimitive || field.PropertyType.IsValueType || field.PropertyType == typeof(String) || field.PropertyType == typeof(byte[]))
+ if (field.PropertyType.IsPrimitive || field.PropertyType.IsValueType || field.PropertyType == typeof(String))
{
dtoCodeBase.Properties.Add(new Property()
{
@@ -245,7 +230,7 @@ namespace Tango.DBObservablesGenerator.CLI
//Generate Enumerations...
using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource))
{
- foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericTypeAndNotNullable()))
+ foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType))
{
try
{
@@ -395,7 +380,7 @@ namespace Tango.DBObservablesGenerator.CLI
codeField.Description = FirstCharacterToLower(DalNameToStandardName(name));
- if (field.PropertyType.IsGenericTypeAndNotNullable())
+ if (field.PropertyType.IsGenericType)
{
continue;
}
@@ -443,7 +428,7 @@ namespace Tango.DBObservablesGenerator.CLI
//Generate Enumerations...
using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource))
{
- foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericTypeAndNotNullable()))
+ foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType))
{
try
{