aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-12-10 16:46:54 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-12-10 16:46:54 +0200
commit3eabdee9604ad67cdbab7ee35bdfa249402f8831 (patch)
tree430724d34efbab485821b3bbab28bfbe92b6df26 /Software/Visual_Studio/Tango.UnitTesting
parent8b4e0971171d40844ca1c63591aeb1fbe4add759 (diff)
downloadTango-3eabdee9604ad67cdbab7ee35bdfa249402f8831.tar.gz
Tango-3eabdee9604ad67cdbab7ee35bdfa249402f8831.zip
Implemented DB Observables Generator CLI for DAL.Observables post build event.
Changes DB table FIBER_SYNTHESIS to FIBER_SYNTHESISES to normalize singularization.
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs53
1 files changed, 2 insertions, 51 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs
index 6e546b306..571107031 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs
@@ -4,12 +4,7 @@ using Tango.DAL.Remote.DB;
using Tango.DAL.Observables;
using Tango.Settings;
using System.Linq;
-using System.Collections;
-using Tango.CodeGeneration;
-using System.Data.Entity;
using System.Collections.Generic;
-using System.IO;
-using System.Data.Entity.Design.PluralizationServices;
namespace Tango.UnitTesting
{
@@ -22,46 +17,8 @@ namespace Tango.UnitTesting
{
String tempPath = Helper.GetTempFolderPath();
- foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType)))
- {
- EntityCodeFile codeFile = new EntityCodeFile(Singularize(ObservableEntity<Object>.DalNameToStandardName(table.Name)))
- {
- EntityName = Singularize(table.Name),
- TableName = table.Name,
- };
-
- foreach (var field in table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(4))
- {
- EntityCodeFileField codeField = new EntityCodeFileField();
- codeField.FieldName = field.Name;
- codeField.Name = ObservableEntity<Object>.DalNameToStandardName(field.Name);
- codeField.Description = field.Name.Replace("_", " ").ToLower();
-
-
- if (field.PropertyType.IsGenericType)
- {
- codeField.Type = String.Format("ObservableCollection<{0}>", Singularize(ObservableEntity<Object>.DalNameToStandardName(field.PropertyType.GenericTypeArguments.Single().Name)));
- codeField.Construct = true;
- }
- else
- {
- if (field.PropertyType.IsClass && field.PropertyType != typeof(String))
- {
- codeField.Type = Singularize(ObservableEntity<Object>.DalNameToStandardName(field.PropertyType.Name));
- codeField.Construct = true;
- }
- else
- {
- codeField.Type = field.PropertyType.Name;
- }
- }
- codeFile.Fields.Add(codeField);
- }
-
- String code = codeFile.GenerateCode();
-
- File.WriteAllText(Path.Combine(tempPath, codeFile.Name + ".cs"), code);
- }
+ ObservablesGenerator generator = new ObservablesGenerator();
+ generator.Generate(tempPath);
Helper.ShowInExplorer(tempPath);
}
@@ -83,11 +40,5 @@ namespace Tango.UnitTesting
db.SaveChanges();
}
}
-
- private String Singularize(String text)
- {
- var serv = PluralizationService.CreateService(new System.Globalization.CultureInfo("en-us"));
- return serv.Singularize(text);
- }
}
}