diff options
27 files changed, 375 insertions, 169 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs index 5699d27a0..3b46ab7cc 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Data.Entity.Design.PluralizationServices; using System.Linq; using System.Text; using System.Text.RegularExpressions; @@ -49,4 +50,26 @@ public static class StringExtensions { return titleRegEx.Replace(str, " "); } + + /// <summary> + /// Singularizes the specified text. + /// </summary> + /// <param name="text">The text.</param> + /// <returns></returns> + public static String Singularize(this String text) + { + var serv = PluralizationService.CreateService(new System.Globalization.CultureInfo("en-us")); + return serv.Singularize(text); + } + + /// <summary> + /// Pluralizes the specified text. + /// </summary> + /// <param name="text">The text.</param> + /// <returns></returns> + public static String Pluralize(this String text) + { + var serv = PluralizationService.CreateService(new System.Globalization.CultureInfo("en-us")); + return serv.Pluralize(text); + } } diff --git a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs index 146dbbade..00c785ac0 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs @@ -33,6 +33,18 @@ namespace Tango.Core.Helpers } } + public static bool TryDeleteFile(String path) + { + try + { + File.Delete(path); + return true; + } + catch + { + return false; + } + } public static void CopyDirectory(string sourceDirName, string destDirName, bool copySubDirs) { diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index c346a4d77..7af35f628 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -38,6 +38,7 @@ <Reference Include="PresentationFramework" /> <Reference Include="System" /> <Reference Include="System.Core" /> + <Reference Include="System.Data.Entity.Design" /> <Reference Include="System.Windows" /> <Reference Include="System.Xaml" /> <Reference Include="System.Xml.Linq" /> diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/FIBER_SYNTHESIS.cs b/Software/Visual_Studio/Tango.DAL.Local/DB/FIBER_SYNTHESISES.cs index 07f0375b6..f6667a7c1 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/FIBER_SYNTHESIS.cs +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/FIBER_SYNTHESISES.cs @@ -12,7 +12,7 @@ namespace Tango.DAL.Local.DB using System; using System.Collections.Generic; - public partial class FIBER_SYNTHESIS + public partial class FIBER_SYNTHESISES { public long ID { get; set; } public string GUID { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs index cef37a5d8..1c639e33d 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs @@ -42,7 +42,7 @@ namespace Tango.DAL.Local.DB public virtual DbSet<EVENT> EVENTS { get; set; } public virtual DbSet<EVENTS_ACTIONS> EVENTS_ACTIONS { get; set; } public virtual DbSet<FIBER_SHAPES> FIBER_SHAPES { get; set; } - public virtual DbSet<FIBER_SYNTHESIS> FIBER_SYNTHESIS { get; set; } + public virtual DbSet<FIBER_SYNTHESISES> FIBER_SYNTHESISES { get; set; } public virtual DbSet<HARDWARE_VERSIONS> HARDWARE_VERSIONS { get; set; } public virtual DbSet<IDS_PACKS> IDS_PACKS { get; set; } public virtual DbSet<LINEAR_MASS_DENSITY_UNITS> LINEAR_MASS_DENSITY_UNITS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx index 7b8078983..f426d5645 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx @@ -188,7 +188,7 @@ <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> </EntityType> - <EntityType Name="FIBER_SYNTHESIS"> + <EntityType Name="FIBER_SYNTHESISES"> <Key> <PropertyRef Name="ID" /> </Key> @@ -472,7 +472,7 @@ <EntitySet Name="EVENTS" EntityType="Self.EVENTS" store:Type="Tables" /> <EntitySet Name="EVENTS_ACTIONS" EntityType="Self.EVENTS_ACTIONS" store:Type="Tables" /> <EntitySet Name="FIBER_SHAPES" EntityType="Self.FIBER_SHAPES" store:Type="Tables" /> - <EntitySet Name="FIBER_SYNTHESIS" EntityType="Self.FIBER_SYNTHESIS" store:Type="Tables" /> + <EntitySet Name="FIBER_SYNTHESISES" EntityType="Self.FIBER_SYNTHESISES" store:Type="Tables" /> <EntitySet Name="HARDWARE_VERSIONS" EntityType="Self.HARDWARE_VERSIONS" store:Type="Tables" /> <EntitySet Name="IDS_PACKS" EntityType="Self.IDS_PACKS" store:Type="Tables" /> <EntitySet Name="LINEAR_MASS_DENSITY_UNITS" EntityType="Self.LINEAR_MASS_DENSITY_UNITS" store:Type="Tables" /> @@ -518,7 +518,7 @@ <EntitySet Name="EVENTS" EntityType="LocalModel.EVENT" /> <EntitySet Name="EVENTS_ACTIONS" EntityType="LocalModel.EVENTS_ACTIONS" /> <EntitySet Name="FIBER_SHAPES" EntityType="LocalModel.FIBER_SHAPES" /> - <EntitySet Name="FIBER_SYNTHESIS" EntityType="LocalModel.FIBER_SYNTHESIS" /> + <EntitySet Name="FIBER_SYNTHESISES" EntityType="LocalModel.FIBER_SYNTHESISES" /> <EntitySet Name="HARDWARE_VERSIONS" EntityType="LocalModel.HARDWARE_VERSIONS" /> <EntitySet Name="IDS_PACKS" EntityType="LocalModel.IDS_PACKS" /> <EntitySet Name="LINEAR_MASS_DENSITY_UNITS" EntityType="LocalModel.LINEAR_MASS_DENSITY_UNITS" /> @@ -725,7 +725,7 @@ <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> </EntityType> - <EntityType Name="FIBER_SYNTHESIS"> + <EntityType Name="FIBER_SYNTHESISES"> <Key> <PropertyRef Name="ID" /> </Key> @@ -1197,9 +1197,9 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> - <EntitySetMapping Name="FIBER_SYNTHESIS"> - <EntityTypeMapping TypeName="LocalModel.FIBER_SYNTHESIS"> - <MappingFragment StoreEntitySet="FIBER_SYNTHESIS"> + <EntitySetMapping Name="FIBER_SYNTHESISES"> + <EntityTypeMapping TypeName="LocalModel.FIBER_SYNTHESISES"> + <MappingFragment StoreEntitySet="FIBER_SYNTHESISES"> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram index 6f8768e4b..ceebf2b45 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram @@ -22,7 +22,7 @@ <EntityTypeShape EntityType="LocalModel.EVENT" Width="1.5" PointX="8.75" PointY="9.75" /> <EntityTypeShape EntityType="LocalModel.EVENTS_ACTIONS" Width="1.5" PointX="10.75" PointY="0.75" /> <EntityTypeShape EntityType="LocalModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="10.75" /> - <EntityTypeShape EntityType="LocalModel.FIBER_SYNTHESIS" Width="1.5" PointX="10.75" PointY="3.75" /> + <EntityTypeShape EntityType="LocalModel.FIBER_SYNTHESISES" Width="1.5" PointX="10.75" PointY="3.75" /> <EntityTypeShape EntityType="LocalModel.HARDWARE_VERSIONS" Width="1.5" PointX="10.75" PointY="6.75" /> <EntityTypeShape EntityType="LocalModel.IDS_PACKS" Width="1.5" PointX="10.75" PointY="9.75" /> <EntityTypeShape EntityType="LocalModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="2.75" PointY="11.75" /> diff --git a/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj b/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj index f891e703d..2296ce942 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj +++ b/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj @@ -116,7 +116,7 @@ <Compile Include="DB\FIBER_SHAPES.cs"> <DependentUpon>LocalADO.tt</DependentUpon> </Compile> - <Compile Include="DB\FIBER_SYNTHESIS.cs"> + <Compile Include="DB\FIBER_SYNTHESISES.cs"> <DependentUpon>LocalADO.tt</DependentUpon> </Compile> <Compile Include="DB\HARDWARE_VERSIONS.cs"> diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynthesi.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynthesis.cs index 687c3ac21..3e2acc54f 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynthesi.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynthesis.cs @@ -6,13 +6,13 @@ using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("FIBER_SYNTHESIS")] - public class FiberSynthesi : ObservableEntity<FIBER_SYNTHESIS> + [EntityFieldName("FIBER_SYNTHESISES")] + public class FiberSynthesis : ObservableEntity<FIBER_SYNTHESISES> { private String _name; /// <summary> - /// Gets or sets the fibersynthesi name. + /// Gets or sets the fibersynthesis name. /// </summary> [EntityFieldName("NAME")] public String Name @@ -31,7 +31,7 @@ namespace Tango.DAL.Observables private Int32 _code; /// <summary> - /// Gets or sets the fibersynthesi code. + /// Gets or sets the fibersynthesis code. /// </summary> [EntityFieldName("CODE")] public Int32 Code @@ -50,7 +50,7 @@ namespace Tango.DAL.Observables private ObservableCollection<Rml> _rmls; /// <summary> - /// Gets or sets the fibersynthesi rmls. + /// Gets or sets the fibersynthesis rmls. /// </summary> [EntityFieldName("RMLS")] public ObservableCollection<Rml> Rmls @@ -68,18 +68,18 @@ namespace Tango.DAL.Observables } /// <summary> - /// Initializes a new instance of the <see cref="FiberSynthesi" /> class. + /// Initializes a new instance of the <see cref="FiberSynthesis" /> class. /// </summary> - public FiberSynthesi() : base() + public FiberSynthesis() : base() { Init(); } /// <summary> - /// Initializes a new instance of the <see cref="FiberSynthesi" /> class. + /// Initializes a new instance of the <see cref="FiberSynthesis" /> class. /// </summary> /// <param name="entity">The entity.</param> - public FiberSynthesi(FIBER_SYNTHESIS entity) : base(entity) + public FiberSynthesis(FIBER_SYNTHESISES entity) : base(entity) { Init(); MapEntityToObservable(entity, this); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs index a77aa5017..d3a683b2b 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs @@ -371,21 +371,21 @@ namespace Tango.DAL.Observables } - private FiberSynthesi _fibersynthesis; + private FiberSynthesis _fibersynthesises; /// <summary> - /// Gets or sets the rml fiber synthesis. + /// Gets or sets the rml fiber synthesises. /// </summary> - [EntityFieldName("FIBER_SYNTHESIS")] - public FiberSynthesi FiberSynthesis + [EntityFieldName("FIBER_SYNTHESISES")] + public FiberSynthesis FiberSynthesises { get { - return _fibersynthesis; + return _fibersynthesises; } set { - _fibersynthesis = value; RaisePropertyChanged(nameof(FiberSynthesis)); + _fibersynthesises = value; RaisePropertyChanged(nameof(FiberSynthesises)); } } @@ -530,7 +530,7 @@ namespace Tango.DAL.Observables FiberShapes = new FiberShape(); - FiberSynthesis = new FiberSynthesi(); + FiberSynthesises = new FiberSynthesis(); LinearMassDensityUnits = new LinearMassDensityUnit(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs index 523fab35f..120c4fca9 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs @@ -39,9 +39,29 @@ namespace Tango.DAL.Observables } } - public abstract class ObservableEntity<T> : ExtendedObject, IObservableEntity where T : class + public abstract class ObservableEntity : ExtendedObject, IObservableEntity { + public abstract int ID { get; set; } + public abstract string Guid { get; set; } + public abstract DateTime LastUpdated { get; set; } + public abstract bool Deleted { get; set; } + public abstract void Save(DbContext context); + public abstract void Save(List<IObservableEntity> savedEntities, DbContext context); + + public static String DalNameToStandardName(String dalName) + { + return String.Join("", dalName.Split('_').Select(x => ToTitleCase(x))); + } + + public static string ToTitleCase(string s) + { + return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.ToLower()); + } + } + + public abstract class ObservableEntity<T> : ObservableEntity where T : class + { private Regex regExDAL; private bool _isNew; @@ -49,7 +69,7 @@ namespace Tango.DAL.Observables private Int32 _id; [EntityFieldName("ID")] - public Int32 ID + public override Int32 ID { get { return _id; } set { _id = value; RaisePropertyChanged(nameof(ID)); } @@ -57,7 +77,7 @@ namespace Tango.DAL.Observables private String _guid; [EntityFieldName("GUID")] - public String Guid + public override String Guid { get { return _guid; } set { _guid = value; RaisePropertyChanged(nameof(Guid)); } @@ -65,7 +85,7 @@ namespace Tango.DAL.Observables private DateTime _lastUpdated; [EntityFieldName("LAST_UPDATED")] - public DateTime LastUpdated + public override DateTime LastUpdated { get { return _lastUpdated; } set { _lastUpdated = value; RaisePropertyChanged(nameof(LastUpdated)); } @@ -73,7 +93,7 @@ namespace Tango.DAL.Observables private bool _deleted; [EntityFieldName("DELETED")] - public bool Deleted + public override bool Deleted { get { return _deleted; } set { _deleted = value; RaisePropertyChanged(nameof(Deleted)); } @@ -157,12 +177,12 @@ namespace Tango.DAL.Observables } } - public void Save(DbContext context) + public override void Save(DbContext context) { Save(new List<IObservableEntity>(), context); } - public void Save(List<IObservableEntity> savedEntities, DbContext context) + public override void Save(List<IObservableEntity> savedEntities, DbContext context) { savedEntities.Add(this); @@ -210,15 +230,5 @@ namespace Tango.DAL.Observables _isNew = false; } } - - public static String DalNameToStandardName(String dalName) - { - return String.Join("", dalName.Split('_').Select(x => ToTitleCase(x))); - } - - public static string ToTitleCase(string s) - { - return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.ToLower()); - } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs new file mode 100644 index 000000000..75deabc87 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.CodeGeneration; +using Tango.DAL.Remote.DB; + +namespace Tango.DAL.Observables +{ + public class ObservablesGenerator + { + public void Generate(String targetPath) + { + foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) + { + EntityCodeFile codeFile = new EntityCodeFile(ObservableEntity.DalNameToStandardName(table.Name).Singularize()) + { + EntityName = table.Name.Singularize(), + 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.DalNameToStandardName(field.Name); + codeField.Description = field.Name.Replace("_", " ").ToLower(); + + + if (field.PropertyType.IsGenericType) + { + codeField.Type = String.Format("ObservableCollection<{0}>", ObservableEntity.DalNameToStandardName(field.PropertyType.GenericTypeArguments.Single().Name).Singularize()); + codeField.Construct = true; + } + else + { + if (field.PropertyType.IsClass && field.PropertyType != typeof(String)) + { + codeField.Type = ObservableEntity.DalNameToStandardName(field.PropertyType.Name).Singularize(); + codeField.Construct = true; + } + else + { + codeField.Type = field.PropertyType.Name; + } + } + codeFile.Fields.Add(codeField); + } + + String code = codeFile.GenerateCode(); + + File.WriteAllText(Path.Combine(targetPath, codeFile.Name + ".cs"), code); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj b/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj index e9d8a37fa..801e6717a 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj +++ b/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj @@ -50,53 +50,19 @@ <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> - <Compile Include="Entities\Action.cs" /> - <Compile Include="Entities\Address.cs" /> - <Compile Include="Entities\ApplicationDisplayPanelVersion.cs" /> - <Compile Include="Entities\ApplicationFirmwareVersion.cs" /> - <Compile Include="Entities\ApplicationOsVersion.cs" /> - <Compile Include="Entities\ApplicationVersion.cs" /> - <Compile Include="Entities\Cartridge.cs" /> - <Compile Include="Entities\CartridgeType.cs" /> - <Compile Include="Entities\Configuration.cs" /> - <Compile Include="Entities\Contact.cs" /> - <Compile Include="Entities\Dispenser.cs" /> - <Compile Include="Entities\DispenserType.cs" /> - <Compile Include="Entities\EmbeddedFirmwareVersion.cs" /> - <Compile Include="Entities\EmbeddedSoftwareVersion.cs" /> - <Compile Include="Entities\Event.cs" /> - <Compile Include="Entities\EventsAction.cs" /> - <Compile Include="Entities\FiberShape.cs" /> - <Compile Include="Entities\FiberSynthesi.cs" /> - <Compile Include="Entities\HardwareVersion.cs" /> - <Compile Include="Entities\IdsPack.cs" /> - <Compile Include="Entities\LinearMassDensityUnit.cs" /> - <Compile Include="Entities\Liquid.cs" /> - <Compile Include="Entities\LiquidsRml.cs" /> - <Compile Include="Entities\Machine.cs" /> - <Compile Include="Entities\MachinesConfiguration.cs" /> - <Compile Include="Entities\MachinesEvent.cs" /> - <Compile Include="Entities\MachineVersion.cs" /> - <Compile Include="Entities\MachineVersionsConfiguration.cs" /> - <Compile Include="Entities\MediaColor.cs" /> - <Compile Include="Entities\MediaCondition.cs" /> - <Compile Include="Entities\MediaMaterial.cs" /> - <Compile Include="Entities\MediaPurpos.cs" /> - <Compile Include="Entities\Organization.cs" /> - <Compile Include="Entities\Permission.cs" /> - <Compile Include="Entities\Rml.cs" /> - <Compile Include="Entities\Role.cs" /> - <Compile Include="Entities\RolesPermission.cs" /> - <Compile Include="Entities\SyncConfiguration.cs" /> - <Compile Include="Entities\User.cs" /> - <Compile Include="Entities\UsersRole.cs" /> <Compile Include="EntityFieldNameAttribute.cs" /> <Compile Include="ExtensionMethods.cs" /> <Compile Include="IObservableEntity.cs" /> <Compile Include="ObservableEntity.cs" /> + <Compile Include="ObservablesGenerator.cs" /> + <Compile Include="Entities\*.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Tango.CodeGeneration\Tango.CodeGeneration.csproj"> + <Project>{caedae94-11ed-473c-888a-268a6d38cd20}</Project> + <Name>Tango.CodeGeneration</Name> + </ProjectReference> <ProjectReference Include="..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> @@ -114,6 +80,15 @@ <None Include="App.config" /> <None Include="packages.config" /> </ItemGroup> - <ItemGroup /> + <ItemGroup> + <Folder Include="Entities\" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PreBuildEvent> + </PreBuildEvent> + </PropertyGroup> + <PropertyGroup> + <PostBuildEvent>"$(TargetDir)dbobgen.exe" "$(SolutionDir)Tango.DAL.Observables\Entities"</PostBuildEvent> + </PropertyGroup> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHESIS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHESISES.cs index 729c5ecb5..551041fa3 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHESIS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHESISES.cs @@ -12,10 +12,10 @@ namespace Tango.DAL.Remote.DB using System; using System.Collections.Generic; - public partial class FIBER_SYNTHESIS + public partial class FIBER_SYNTHESISES { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public FIBER_SYNTHESIS() + public FIBER_SYNTHESISES() { this.RMLS = new HashSet<RML>(); } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index 28b213f90..89a4fe609 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -44,7 +44,7 @@ namespace Tango.DAL.Remote.DB public double ESTIMATED_THREAD_DIAMETER { get; set; } public virtual FIBER_SHAPES FIBER_SHAPES { get; set; } - public virtual FIBER_SYNTHESIS FIBER_SYNTHESIS { get; set; } + public virtual FIBER_SYNTHESISES FIBER_SYNTHESISES { get; set; } public virtual LINEAR_MASS_DENSITY_UNITS LINEAR_MASS_DENSITY_UNITS { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<LIQUIDS_RMLS> LIQUIDS_RMLS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs index af6af171c..2da6d31b1 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -42,7 +42,7 @@ namespace Tango.DAL.Remote.DB public virtual DbSet<EVENT> EVENTS { get; set; } public virtual DbSet<EVENTS_ACTIONS> EVENTS_ACTIONS { get; set; } public virtual DbSet<FIBER_SHAPES> FIBER_SHAPES { get; set; } - public virtual DbSet<FIBER_SYNTHESIS> FIBER_SYNTHESIS { get; set; } + public virtual DbSet<FIBER_SYNTHESISES> FIBER_SYNTHESISES { get; set; } public virtual DbSet<HARDWARE_VERSIONS> HARDWARE_VERSIONS { get; set; } public virtual DbSet<IDS_PACKS> IDS_PACKS { get; set; } public virtual DbSet<LINEAR_MASS_DENSITY_UNITS> LINEAR_MASS_DENSITY_UNITS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index a73b40ac8..6dc1ad1ed 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -191,7 +191,7 @@ <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="CODE" Type="int" Nullable="false" /> </EntityType> - <EntityType Name="FIBER_SYNTHESIS"> + <EntityType Name="FIBER_SYNTHESISES"> <Key> <PropertyRef Name="GUID" /> </Key> @@ -823,10 +823,10 @@ </ReferentialConstraint> </Association> <Association Name="FK_RML_FIBER_SYNTHESIS"> - <End Role="FIBER_SYNTHESIS" Type="Self.FIBER_SYNTHESIS" Multiplicity="1" /> + <End Role="FIBER_SYNTHESISES" Type="Self.FIBER_SYNTHESISES" Multiplicity="1" /> <End Role="RMLS" Type="Self.RMLS" Multiplicity="*" /> <ReferentialConstraint> - <Principal Role="FIBER_SYNTHESIS"> + <Principal Role="FIBER_SYNTHESISES"> <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RMLS"> @@ -998,7 +998,7 @@ <EntitySet Name="EVENTS" EntityType="Self.EVENTS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="EVENTS_ACTIONS" EntityType="Self.EVENTS_ACTIONS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="FIBER_SHAPES" EntityType="Self.FIBER_SHAPES" Schema="dbo" store:Type="Tables" /> - <EntitySet Name="FIBER_SYNTHESIS" EntityType="Self.FIBER_SYNTHESIS" Schema="dbo" store:Type="Tables" /> + <EntitySet Name="FIBER_SYNTHESISES" EntityType="Self.FIBER_SYNTHESISES" Schema="dbo" store:Type="Tables" /> <EntitySet Name="HARDWARE_VERSIONS" EntityType="Self.HARDWARE_VERSIONS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="IDS_PACKS" EntityType="Self.IDS_PACKS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="LINEAR_MASS_DENSITY_UNITS" EntityType="Self.LINEAR_MASS_DENSITY_UNITS" Schema="dbo" store:Type="Tables" /> @@ -1138,7 +1138,7 @@ <End Role="RMLS" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_RML_FIBER_SYNTHESIS" Association="Self.FK_RML_FIBER_SYNTHESIS"> - <End Role="FIBER_SYNTHESIS" EntitySet="FIBER_SYNTHESIS" /> + <End Role="FIBER_SYNTHESISES" EntitySet="FIBER_SYNTHESISES" /> <End Role="RMLS" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_RML_LINEAR_MASS_DENSITY_UNITS" Association="Self.FK_RML_LINEAR_MASS_DENSITY_UNITS"> @@ -1212,7 +1212,7 @@ <EntitySet Name="EVENTS" EntityType="RemoteModel.EVENT" /> <EntitySet Name="EVENTS_ACTIONS" EntityType="RemoteModel.EVENTS_ACTIONS" /> <EntitySet Name="FIBER_SHAPES" EntityType="RemoteModel.FIBER_SHAPES" /> - <EntitySet Name="FIBER_SYNTHESIS" EntityType="RemoteModel.FIBER_SYNTHESIS" /> + <EntitySet Name="FIBER_SYNTHESISES" EntityType="RemoteModel.FIBER_SYNTHESISES" /> <EntitySet Name="HARDWARE_VERSIONS" EntityType="RemoteModel.HARDWARE_VERSIONS" /> <EntitySet Name="IDS_PACKS" EntityType="RemoteModel.IDS_PACKS" /> <EntitySet Name="LINEAR_MASS_DENSITY_UNITS" EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" /> @@ -1324,7 +1324,7 @@ <End Role="RML" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_RML_FIBER_SYNTHESIS" Association="RemoteModel.FK_RML_FIBER_SYNTHESIS"> - <End Role="FIBER_SYNTHESIS" EntitySet="FIBER_SYNTHESIS" /> + <End Role="FIBER_SYNTHESISES" EntitySet="FIBER_SYNTHESISES" /> <End Role="RML" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_CONFIGURATIONS_DISPENSERS_LIQUIDS" Association="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_LIQUIDS"> @@ -1622,7 +1622,7 @@ <Property Name="CODE" Type="Int32" Nullable="false" /> <NavigationProperty Name="RMLS" Relationship="RemoteModel.FK_RML_FIBER_SHAPES" FromRole="FIBER_SHAPES" ToRole="RML" /> </EntityType> - <EntityType Name="FIBER_SYNTHESIS"> + <EntityType Name="FIBER_SYNTHESISES"> <Key> <PropertyRef Name="GUID" /> </Key> @@ -1632,7 +1632,7 @@ <Property Name="DELETED" Type="Boolean" Nullable="false" /> <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="CODE" Type="Int32" Nullable="false" /> - <NavigationProperty Name="RMLS" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="FIBER_SYNTHESIS" ToRole="RML" /> + <NavigationProperty Name="RMLS" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="FIBER_SYNTHESISES" ToRole="RML" /> </EntityType> <EntityType Name="HARDWARE_VERSIONS"> <Key> @@ -1874,7 +1874,7 @@ <Property Name="ELONGATION_AT_BREAK_PERCENTAGE" Type="Double" Nullable="false" /> <Property Name="ESTIMATED_THREAD_DIAMETER" Type="Double" Nullable="false" /> <NavigationProperty Name="FIBER_SHAPES" Relationship="RemoteModel.FK_RML_FIBER_SHAPES" FromRole="RML" ToRole="FIBER_SHAPES" /> - <NavigationProperty Name="FIBER_SYNTHESIS" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="RML" ToRole="FIBER_SYNTHESIS" /> + <NavigationProperty Name="FIBER_SYNTHESISES" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="RML" ToRole="FIBER_SYNTHESISES" /> <NavigationProperty Name="LINEAR_MASS_DENSITY_UNITS" Relationship="RemoteModel.FK_RML_LINEAR_MASS_DENSITY_UNITS" FromRole="RML" ToRole="LINEAR_MASS_DENSITY_UNITS" /> <NavigationProperty Name="LIQUIDS_RMLS" Relationship="RemoteModel.FK_LIQUIDS_RML_RML" FromRole="RML" ToRole="LIQUIDS_RMLS" /> <NavigationProperty Name="MEDIA_COLORS" Relationship="RemoteModel.FK_RML_MEDIA_COLORS" FromRole="RML" ToRole="MEDIA_COLORS" /> @@ -2218,10 +2218,10 @@ </ReferentialConstraint> </Association> <Association Name="FK_RML_FIBER_SYNTHESIS"> - <End Type="RemoteModel.FIBER_SYNTHESIS" Role="FIBER_SYNTHESIS" Multiplicity="1" /> + <End Type="RemoteModel.FIBER_SYNTHESISES" Role="FIBER_SYNTHESISES" Multiplicity="1" /> <End Type="RemoteModel.RML" Role="RML" Multiplicity="*" /> <ReferentialConstraint> - <Principal Role="FIBER_SYNTHESIS"> + <Principal Role="FIBER_SYNTHESISES"> <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RML"> @@ -2672,9 +2672,9 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> - <EntitySetMapping Name="FIBER_SYNTHESIS"> - <EntityTypeMapping TypeName="RemoteModel.FIBER_SYNTHESIS"> - <MappingFragment StoreEntitySet="FIBER_SYNTHESIS"> + <EntitySetMapping Name="FIBER_SYNTHESISES"> + <EntityTypeMapping TypeName="RemoteModel.FIBER_SYNTHESISES"> + <MappingFragment StoreEntitySet="FIBER_SYNTHESISES"> <ScalarProperty Name="CODE" ColumnName="CODE" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 79df7bb02..390be5547 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -6,26 +6,26 @@ <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> <EntityTypeShape EntityType="RemoteModel.ACTION" Width="1.5" PointX="9" PointY="37.375" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="41.5" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="37.375" /> <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="23.625" /> <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="15.375" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="10" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="12.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="18.125" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="20.875" /> <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="0.75" PointY="46.5" /> <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="3" PointY="46.375" /> <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="4.625" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="37.375" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="41.75" /> <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="2.625" /> <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="20.875" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="18.125" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="12.75" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="10" /> <EntityTypeShape EntityType="RemoteModel.EVENT" Width="1.5" PointX="6" PointY="41.25" /> <EntityTypeShape EntityType="RemoteModel.EVENTS_ACTIONS" Width="1.5" PointX="11.25" PointY="41.375" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="5.75" PointY="18.75" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHESIS" Width="1.5" PointX="5.75" PointY="15.625" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="5.75" PointY="32" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHESISES" Width="1.5" PointX="5.75" PointY="12.375" /> <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="6.25" /> <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="5.625" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="5.75" PointY="31" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="5.75" PointY="15.625" /> <EntityTypeShape EntityType="RemoteModel.LIQUID" Width="1.5" PointX="3" PointY="10.875" /> <EntityTypeShape EntityType="RemoteModel.LIQUIDS_RMLS" Width="1.5" PointX="10.25" PointY="12.25" /> <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="0.75" PointY="27.375" /> @@ -33,10 +33,10 @@ <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="3" PointY="31" /> <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="5.25" PointY="2" /> <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="8.25" PointY="31" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="5.75" PointY="25" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="5.75" PointY="12.375" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="5.75" PointY="21.875" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="5.75" PointY="27.875" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="5.75" PointY="18.75" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="5.75" PointY="25.75" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="5.75" PointY="22.625" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="5.75" PointY="28.875" /> <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="0.75" PointY="32.625" /> <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="6.75" PointY="45.625" /> <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="8" PointY="10.125" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj index 129b01850..6ac6c35c3 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -116,7 +116,7 @@ <Compile Include="DB\FIBER_SHAPES.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> - <Compile Include="DB\FIBER_SYNTHESIS.cs"> + <Compile Include="DB\FIBER_SYNTHESISES.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> <Compile Include="DB\HARDWARE_VERSIONS.cs"> 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); - } } } diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index b8fc45063..6551f2c0b 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -81,6 +81,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.SharedUI", "Tango.Sha EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DAL.Observables", "Tango.DAL.Observables\Tango.DAL.Observables.csproj", "{0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.DBObservablesGenerator.CLI", "Utilities\Tango.DBObservablesGenerator.CLI\Tango.DBObservablesGenerator.CLI.csproj", "{EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -449,6 +451,18 @@ Global {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Release|x64.Build.0 = Release|Any CPU {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Release|x86.ActiveCfg = Release|Any CPU {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Release|x86.Build.0 = Release|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Debug|x64.ActiveCfg = Debug|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Debug|x64.Build.0 = Debug|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Debug|x86.ActiveCfg = Debug|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Debug|x86.Build.0 = Debug|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Release|Any CPU.Build.0 = Release|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Release|x64.ActiveCfg = Release|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Release|x64.Build.0 = Release|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Release|x86.ActiveCfg = Release|Any CPU + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -467,5 +481,6 @@ Global {BCD0C108-FC90-4537-8B80-ABBD201FECA3} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {FC0FB4A1-360E-42B1-8372-9208A3098B2A} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {EC62BC9C-F2FE-4333-B7E4-110E38D43958} + {EBB7CB9F-6AF2-456B-A5DD-1B136B605D90} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/App.config b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/App.config new file mode 100644 index 000000000..92aa00bf9 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/App.config @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> + </startup> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs new file mode 100644 index 000000000..742b1428d --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Helpers; +using Tango.DAL.Observables; + +namespace Tango.DBObservablesGenerator.CLI +{ + class Program + { + static void Main(string[] args) + { + try + { + if (args == null || args.Length == 0) + { + ExitError("Invalid arguments!"); + } + + String targetPath = args[0]; + + ObservablesGenerator generator = new ObservablesGenerator(); + + foreach (var file in Directory.GetFiles(targetPath)) + { + PathHelper.TryDeleteFile(file); + } + + try + { + generator.Generate(targetPath); + } + catch (Exception ex) + { + ExitError(ex.ToString()); + } + + ExitSuccess("Tango DAL observables generated on: '" + targetPath + "'\nPlease build again to ensure compatibility."); + } + catch + { + ExitSuccess("Tango DAL observables generation skipped! Try Build again..."); + } + } + + private static void ExitError(String error) + { + Console.WriteLine(error); + Environment.Exit(-1); + } + + private static void ExitSuccess(String text) + { + Console.WriteLine(text); + Environment.Exit(0); + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..9260e2580 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Tango - Machine Designer")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Tango.DBObservablesGenerator.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Tango.DBObservablesGenerator.CLI.csproj new file mode 100644 index 000000000..f996d017d --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Tango.DBObservablesGenerator.CLI.csproj @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{EBB7CB9F-6AF2-456B-A5DD-1B136B605D90}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Tango.DBObservablesGenerator.CLI</RootNamespace> + <AssemblyName>dbobgen</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> + <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> + <Name>Tango.DAL.Observables</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/packages.config new file mode 100644 index 000000000..9256e1591 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db b/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db Binary files differindex 8ed3793fe..2e238eadb 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db +++ b/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db |
