diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-01-27 17:18:10 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-01-27 17:18:10 +0200 |
| commit | 20482140c124fd1d5caaffcc9b0dfe853b30dd6f (patch) | |
| tree | 90ddae2089b030833cac9f008767d2b8f96c577f | |
| parent | 7426c54072d63e49eae8a8a9b9a1097c9ecefbd2 (diff) | |
| download | Tango-20482140c124fd1d5caaffcc9b0dfe853b30dd6f.tar.gz Tango-20482140c124fd1d5caaffcc9b0dfe853b30dd6f.zip | |
Re-factored DAL Observables using EF Code First !!!!!!
102 files changed, 2198 insertions, 2465 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex b93b255d8..a9a08206b 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 7c79ea466..c220a4591 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs index 5cdee0153..3f0654247 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.DB.Converters if (value is IEnumerable<EventTypesAction>) { IEnumerable<EventTypesAction> eventActions = value as IEnumerable<EventTypesAction>; - return String.Join(", ", eventActions.Select(x => x.ActionTypes.Name)); + return String.Join(", ", eventActions.Select(x => x.ActionType.Name)); } else { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs index 7f6d84ecf..bdf2105a6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs @@ -44,6 +44,7 @@ namespace Tango.MachineStudio.DB.Managers View = view; View.MaxWidth = 1500; + View.MaxHeight = 800; if (action != null) { @@ -81,6 +82,7 @@ namespace Tango.MachineStudio.DB.Managers } view.MaxWidth = 1500; + view.MaxHeight = 800; Header = header; View = view; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs index 0325e42ee..687c30470 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EventTypesViewVM.cs @@ -29,7 +29,7 @@ namespace Tango.MachineStudio.DB.ViewModels foreach (var actionType in SelectedActions) { - if (SelectedEntity.EventTypesActions.ToList().Exists(x => x.ActionTypes == actionType.Entity)) + if (SelectedEntity.EventTypesActions.ToList().Exists(x => x.ActionType == actionType.Entity)) { actionType.IsSelected = true; } @@ -49,22 +49,16 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, eventType); + Adapter.Context.EventTypesActions.RemoveRange(eventType.EventTypesActions); + foreach (var actionType in SelectedActions) { - var eventTypeAction = eventType.EventTypesActions.SingleOrDefault(x => x.ActionTypes == actionType.Entity); - - if (eventTypeAction != null && !actionType.IsSelected) - { - eventTypeAction.Delete(); - continue; - } - if (actionType.IsSelected) { eventType.EventTypesActions.Add(new EventTypesAction() { - ActionTypes = actionType.Entity, - EventTypes = eventType, + ActionType = actionType.Entity, + EventType = eventType, ActionTypeGuid = actionType.Entity.Guid, EventTypeGuid = eventType.Guid }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs index 49bd18822..05171b09f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidTypesViewVM.cs @@ -49,22 +49,16 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, liquid); + Adapter.Context.LiquidTypesRmls.RemoveRange(liquid.LiquidTypesRmls); + foreach (var rml in SelectedRmls) { - var liquidRml = liquid.LiquidTypesRmls.SingleOrDefault(x => x.Rml == rml.Entity); - - if (liquidRml != null && !rml.IsSelected) - { - liquidRml.Delete(); - continue; - } - if (rml.IsSelected) { liquid.LiquidTypesRmls.Add(new LiquidTypesRml() { Rml = rml.Entity, - LiquidTypes = liquid, + LiquidType = liquid, RmlGuid = rml.Entity.Guid, LiquidTypeGuid = liquid.Guid }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs index 8ce95f736..50caf4c6d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RolesViewVM.cs @@ -50,16 +50,10 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, role); + Adapter.Context.RolesPermissions.RemoveRange(role.RolesPermissions); + foreach (var permission in SelectedPermissions) { - var rolePermission = role.RolesPermissions.SingleOrDefault(x => x.Permission == permission.Entity); - - if (rolePermission != null && !permission.IsSelected) - { - rolePermission.Delete(); - continue; - } - if (permission.IsSelected) { role.RolesPermissions.Add(new RolesPermission() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs index 044b8a88a..e338746ff 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs @@ -50,26 +50,19 @@ namespace Tango.MachineStudio.DB.ViewModels { base.OnBeforeEntitySave(mode, user); + Adapter.Context.UsersRoles.RemoveRange(user.UsersRoles); + foreach (var role in SelectedRoles) { - var userRole = user.UsersRoles.SingleOrDefault(x => x.Role == role.Entity); - - if (userRole != null) - { - userRole.Deleted = !role.IsSelected; - } - else + if (role.IsSelected) { - if (role.IsSelected) + user.UsersRoles.Add(new UsersRole() { - user.UsersRoles.Add(new UsersRole() - { - Role = role.Entity, - User = user, - RoleGuid = role.Entity.Guid, - UserGuid = user.Guid - }); - } + Role = role.Entity, + User = user, + RoleGuid = role.Entity.Guid, + UserGuid = user.Guid + }); } } } @@ -80,7 +73,7 @@ namespace Tango.MachineStudio.DB.ViewModels if (EditEntity.Email != null) { - if (Adapter.Users.ToList().Exists(x => x != EditEntity && x.Email.ToLower() == EditEntity.Email.ToLower())) + if (Adapter.Users.ToList().Exists(x => x.Guid != EditEntity.Guid && x.Email.ToLower() == EditEntity.Email.ToLower())) { ValidationErrors.Add("Email already exist"); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml index 9cd01cfc4..080591c15 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml @@ -32,7 +32,7 @@ <TextBox Text="{Binding EditEntity.Name}"></TextBox> <TextBlock Text="Liquid Type:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidTypes,Mode=TwoWay}"> + <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidType,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml index e72146525..6eb693780 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml @@ -23,13 +23,13 @@ <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Liquid Type" Binding="{Binding LiquidTypes.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Liquid Type" Binding="{Binding LiquidType.Name}"></DataGridTextColumn> <DataGridTemplateColumn Header="Liquid Type Color"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Rectangle Width="50"> <Rectangle.Fill> - <SolidColorBrush Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> + <SolidColorBrush Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> </Rectangle.Fill> </Rectangle> </DataTemplate> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml index afbaf660a..2e34379e5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml @@ -28,25 +28,25 @@ <TextBlock Text="Creation Date:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.CreationDate,Mode=TwoWay}" IsReadOnly="True"></TextBox> <TextBlock Text="Application Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.ApplicationVersions}" SelectedItem="{Binding EditEntity.ApplicationVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.ApplicationVersions}" SelectedItem="{Binding EditEntity.ApplicationVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> <TextBlock Text="Application Firmware Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.ApplicationFirmwareVersions}" SelectedItem="{Binding EditEntity.ApplicationFirmwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.ApplicationFirmwareVersions}" SelectedItem="{Binding EditEntity.ApplicationFirmwareVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> <TextBlock Text="Application OS Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.ApplicationOsVersions}" SelectedItem="{Binding EditEntity.ApplicationOsVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.ApplicationOsVersions}" SelectedItem="{Binding EditEntity.ApplicationOsVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> <TextBlock Text="Display Panel Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.ApplicationDisplayPanelVersions}" SelectedItem="{Binding EditEntity.ApplicationDisplayPanelVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.ApplicationDisplayPanelVersions}" SelectedItem="{Binding EditEntity.ApplicationDisplayPanelVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> <TextBlock Text="Embedded Firmware Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.EmbeddedFirmwareVersions}" SelectedItem="{Binding EditEntity.EmbeddedFirmwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.EmbeddedFirmwareVersions}" SelectedItem="{Binding EditEntity.EmbeddedFirmwareVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> <TextBlock Text="Embedded Software Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.EmbeddedSoftwareVersions}" SelectedItem="{Binding EditEntity.EmbeddedSoftwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.EmbeddedSoftwareVersions}" SelectedItem="{Binding EditEntity.EmbeddedSoftwareVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> <TextBlock Text="Hardware Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding EditEntity.HardwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding EditEntity.HardwareVersion,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> </controls:TableGrid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml index 235e49cc3..819dbd1c7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml @@ -16,13 +16,13 @@ <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> <DataGridTextColumn Header="Creation Date" Binding="{Binding CreationDate}"></DataGridTextColumn> - <DataGridTextColumn Header="Application Version" Binding="{Binding ApplicationVersions.Version}"></DataGridTextColumn> - <DataGridTextColumn Header="Application OS" Binding="{Binding ApplicationOsVersions.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Application Firmware Version" Binding="{Binding ApplicationFirmwareVersions.Version}"></DataGridTextColumn> - <DataGridTextColumn Header="Display Panel" Binding="{Binding ApplicationDisplayPanelVersions.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Embedded Firmware Version" Binding="{Binding EmbeddedFirmwareVersions.Version}"></DataGridTextColumn> - <DataGridTextColumn Header="Embedded Software Version" Binding="{Binding EmbeddedSoftwareVersions.Version}"></DataGridTextColumn> - <DataGridTextColumn Header="Hardware Version" Binding="{Binding HardwareVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Application Version" Binding="{Binding ApplicationVersion.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Application OS" Binding="{Binding ApplicationOsVersion.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Application Firmware Version" Binding="{Binding ApplicationFirmwareVersion.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Display Panel" Binding="{Binding ApplicationDisplayPanelVersion.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Embedded Firmware Version" Binding="{Binding EmbeddedFirmwareVersion.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Embedded Software Version" Binding="{Binding EmbeddedSoftwareVersion.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Hardware Version" Binding="{Binding HardwareVersion.Version}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </controls:DbTableView> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml index 543e6b40c..537bdb9f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml @@ -29,7 +29,7 @@ <TextBlock Text="Configuration:" FontWeight="Bold"></TextBlock> <ComboBox ItemsSource="{Binding Adapter.Configurations}" SelectedItem="{Binding EditEntity.Configuration,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Dispenser Type:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.DispenserTypes}" SelectedItem="{Binding EditEntity.DispenserTypes,Mode=TwoWay}"> + <ComboBox ItemsSource="{Binding Adapter.DispenserTypes}" SelectedItem="{Binding EditEntity.DispenserType,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock><Run Text="{Binding Name}"></Run></TextBlock> @@ -37,7 +37,7 @@ </ComboBox.ItemTemplate> </ComboBox> <TextBlock Text="Liquid Type:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidTypes,Mode=TwoWay}"> + <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidType,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> @@ -52,7 +52,7 @@ </ComboBox.ItemTemplate> </ComboBox> <TextBlock Text="Cartridge Type:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.CartridgeTypes}" SelectedItem="{Binding EditEntity.CartridgeTypes,Mode=TwoWay}"> + <ComboBox ItemsSource="{Binding Adapter.CartridgeTypes}" SelectedItem="{Binding EditEntity.CartridgeType,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock><Run Text="{Binding Name}"></Run></TextBlock> @@ -61,7 +61,7 @@ </ComboBox> <TextBlock Text="Mid Tank Type:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.MidTankTypes}" SelectedItem="{Binding EditEntity.MidTankTypes,Mode=TwoWay}"> + <ComboBox ItemsSource="{Binding Adapter.MidTankTypes}" SelectedItem="{Binding EditEntity.MidTankType,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock><Run Text="{Binding Name}"></Run></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml index e5043e3e2..0837bbf9f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml @@ -25,7 +25,7 @@ <DataGridTemplateColumn Header="Dispenser Type"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <TextBlock><Run Text="{Binding DispenserTypes.Name}"></Run></TextBlock> + <TextBlock><Run Text="{Binding DispenserType.Name}"></Run></TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> @@ -35,10 +35,10 @@ <StackPanel Orientation="Horizontal"> <Rectangle Width="16" Height="16" VerticalAlignment="Center"> <Rectangle.Fill> - <SolidColorBrush Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + <SolidColorBrush Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> </Rectangle.Fill> </Rectangle> - <TextBlock Margin="5 0 0 0" Text="{Binding LiquidTypes.Name}" VerticalAlignment="Center"></TextBlock> + <TextBlock Margin="5 0 0 0" Text="{Binding LiquidType.Name}" VerticalAlignment="Center"></TextBlock> </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> @@ -46,14 +46,14 @@ <DataGridTemplateColumn Header="Cartridge Type"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <TextBlock><Run Text="{Binding CartridgeTypes.Name}"></Run></TextBlock> + <TextBlock><Run Text="{Binding CartridgeType.Name}"></Run></TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTemplateColumn Header="Mid Tank Type"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <TextBlock><Run Text="{Binding MidTankTypes.Name}"></Run></TextBlock> + <TextBlock><Run Text="{Binding MidTankType.Name}"></Run></TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml index a3b3f5eed..2fbe2365c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlView.xaml @@ -21,7 +21,7 @@ <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True" IsEnabled="False"></TextBox> <TextBlock Text="Liquid Type:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidTypes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidType,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="RML:" FontWeight="Bold"></TextBlock> <ComboBox ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding EditEntity.Rml}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Max nl/cm:" FontWeight="Bold"></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml index f96402432..11f781e5b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidTypesRmlsView.xaml @@ -16,9 +16,9 @@ <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> - <DataGridTextColumn Header="Liquid Type" Binding="{Binding LiquidTypes.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Liquid Type" Binding="{Binding LiquidType.Name}"></DataGridTextColumn> <DataGridTextColumn Header="RML" Binding="{Binding Rml.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Maximum Nanolitter Per Centimeter" Binding="{Binding MaxNlPerCm}"></DataGridTextColumn> + <DataGridTextColumn Header="Maximum Nanoliter Per Centimeter" Binding="{Binding MaxNlPerCm}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </controls:DbTableView> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml index 50a1c790b..a15f9c9e1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml @@ -21,7 +21,7 @@ <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> <TextBlock Text="Default Configuration:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.Configurations}" SelectedItem="{Binding EditEntity.Configuration,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.Configurations}" SelectedItem="{Binding EditEntity.DefaultConfiguration,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> </controls:TableGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml index 08cac568f..be917634a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml @@ -16,7 +16,7 @@ <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> - <DataGridTextColumn Header="Default Configuration" Binding="{Binding Configuration.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Default Configuration" Binding="{Binding DefaultConfiguration.Name}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </controls:DbTableView> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml index 0a7ee4c32..ab880a8a8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineView.xaml @@ -22,7 +22,7 @@ <TextBlock Text="Organization:" FontWeight="Bold"></TextBlock> <ComboBox ItemsSource="{Binding Adapter.Organizations}" SelectedItem="{Binding EditEntity.Organization,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.MachineVersions}" SelectedItem="{Binding EditEntity.MachineVersions,Mode=TwoWay}" DisplayMemberPath="Version"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.MachineVersions}" SelectedItem="{Binding EditEntity.MachineVersion,Mode=TwoWay}" DisplayMemberPath="Version"></ComboBox> <TextBlock Text="Configuration:" FontWeight="Bold"></TextBlock> <ComboBox ItemsSource="{Binding Adapter.Configurations}" SelectedItem="{Binding EditEntity.Configuration,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> </controls:TableGrid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml index ea48667d9..c6febd63c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml @@ -16,7 +16,7 @@ <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> <DataGridTextColumn Header="Serial Number" Binding="{Binding SerialNumber}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Version" Binding="{Binding MachineVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding MachineVersion.Version}"></DataGridTextColumn> <DataGridTextColumn Header="Organization" Binding="{Binding Organization.Name}"></DataGridTextColumn> <DataGridTextColumn Header="Configuration" Binding="{Binding Configuration.Name}"></DataGridTextColumn> </DataGrid.Columns> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml index 1e3933ce0..75b559bf2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml @@ -23,7 +23,7 @@ <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> <TextBlock Text="Group:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.ProcessParametersTablesGroups}" SelectedItem="{Binding EditEntity.ProcessParametersTablesGroups,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.ProcessParametersTablesGroups}" SelectedItem="{Binding EditEntity.ProcessParametersTablesGroup,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> <TextBlock Text="Index:" FontWeight="Bold"></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml index d9ad83f68..0e20ce5af 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml @@ -21,7 +21,7 @@ <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> - <DataGridTextColumn Header="Group" Binding="{Binding ProcessParametersTablesGroups.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Group" Binding="{Binding ProcessParametersTablesGroup.Name}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> <DataGridTextColumn Header="Index" Binding="{Binding TableIndex}"></DataGridTextColumn> <DataGridTextColumn Header="Dyeing Speed" Binding="{Binding DyeingSpeed}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml index adf5310ee..43a17d8e4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml @@ -32,10 +32,10 @@ <TextBox Text="{Binding EditEntity.Manufacturer}"></TextBox> <TextBlock Text="Material:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.MediaMaterials}" SelectedItem="{Binding EditEntity.MediaMaterials,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.MediaMaterials}" SelectedItem="{Binding EditEntity.MediaMaterial,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Color:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.MediaColors}" SelectedItem="{Binding EditEntity.MediaColors,Mode=TwoWay}"> + <ComboBox ItemsSource="{Binding Adapter.MediaColors}" SelectedItem="{Binding EditEntity.MediaColor,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> @@ -50,19 +50,19 @@ </ComboBox> <TextBlock Text="Purpose:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.MediaPurposes}" SelectedItem="{Binding EditEntity.MediaPurposes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.MediaPurposes}" SelectedItem="{Binding EditEntity.MediaPurpose,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Condition:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.MediaConditions}" SelectedItem="{Binding EditEntity.MediaConditions,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.MediaConditions}" SelectedItem="{Binding EditEntity.MediaCondition,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Linear Mass Density Unit:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.LinearMassDensityUnits}" SelectedItem="{Binding EditEntity.LinearMassDensityUnits,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.LinearMassDensityUnits}" SelectedItem="{Binding EditEntity.LinearMassDensityUnit,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Fiber Shape:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.FiberShapes}" SelectedItem="{Binding EditEntity.FiberShapes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.FiberShapes}" SelectedItem="{Binding EditEntity.FiberShape,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Fiber Syntheses:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.FiberSynths}" SelectedItem="{Binding EditEntity.FiberSynths,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.FiberSynths}" SelectedItem="{Binding EditEntity.FiberSynth,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Fiber Size:" FontWeight="Bold"></TextBlock> <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.FiberSize,Mode=TwoWay}"></mahapps:NumericUpDown> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml index 0a02c6821..86a61d400 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml @@ -23,23 +23,23 @@ <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> <DataGridTextColumn Header="Manufacturer" Binding="{Binding Manufacturer}"></DataGridTextColumn> - <DataGridTextColumn Header="Material" Binding="{Binding MediaMaterials.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Material" Binding="{Binding MediaMaterial.Name}"></DataGridTextColumn> <DataGridTemplateColumn Header="Color"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Rectangle Width="50"> <Rectangle.Fill> - <SolidColorBrush Color="{Binding MediaColors.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> + <SolidColorBrush Color="{Binding MediaColor.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> </Rectangle.Fill> </Rectangle> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTextColumn Header="Purpose" Binding="{Binding MediaPurposes.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Condition" Binding="{Binding MediaConditions.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Linear Mass Density Unit" Binding="{Binding LinearMassDensityUnits.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Fiber Shape" Binding="{Binding FiberShapes.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Fiber Syntheses" Binding="{Binding FiberSynths.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Purpose" Binding="{Binding MediaPurpose.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Condition" Binding="{Binding MediaCondition.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Linear Mass Density Unit" Binding="{Binding LinearMassDensityUnit.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Fiber Shape" Binding="{Binding FiberShape.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Fiber Syntheses" Binding="{Binding FiberSynth.Name}"></DataGridTextColumn> <DataGridTextColumn Header="Fiber Size" Binding="{Binding FiberSize}"></DataGridTextColumn> <DataGridTextColumn Header="Fibers Count" Binding="{Binding NumberOfFibers}"></DataGridTextColumn> <DataGridTextColumn Header="Plies Per Fiber" Binding="{Binding PliesPerFiber}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 0742ca752..8f3d2a7e3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -44,7 +44,19 @@ namespace Tango.MachineStudio.Developer.ViewModels public Machine SelectedMachine { get { return _selectedMachine; } - set { _selectedMachine = value; RaisePropertyChangedAuto(); OnMachineChanged(); InvalidateRelayCommands(); } + set + { + _selectedMachine = value; + RaisePropertyChangedAuto(); + OnMachineChanged(); + InvalidateRelayCommands(); + + if (_selectedMachine != null) + { + _selectedMachine.Saved -= SelectedMachine_Saved; + _selectedMachine.Saved += SelectedMachine_Saved; + } + } } private List<LiquidTypesRml> _liquidTypesRmls; @@ -104,7 +116,13 @@ namespace Tango.MachineStudio.Developer.ViewModels public Rml SelectedRML { get { return _selectedRML; } - set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateLiquidFactorsAndProcessTables(); InvalidateRelayCommands(); } + set + { + _selectedRML = value; + RaisePropertyChangedAuto(); + InvalidateLiquidFactorsAndProcessTables(); + InvalidateRelayCommands(); + } } private bool _isSideBarOpened; @@ -205,6 +223,20 @@ namespace Tango.MachineStudio.Developer.ViewModels #endregion + #region Event Handlers + + /// <summary> + /// Handles the Saved event of the SelectedMachine. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> + private void SelectedMachine_Saved(object sender, EventArgs e) + { + InvalidateLiquidFactorsAndProcessTables(); + } + + #endregion + #region Virtual Methods /// <summary> @@ -278,7 +310,7 @@ namespace Tango.MachineStudio.Developer.ViewModels foreach (var table in RmlProcessParametersTableGroup.ProcessParametersTables) { var newTable = table.CloneEntity(); - newTable.ProcessParametersTablesGroups = group; + newTable.ProcessParametersTablesGroup = group; tables.Add(newTable); } @@ -313,7 +345,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedRML != null && SelectedMachine != null) { - LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidTypes).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); + LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.SingleOrDefault(x => x.Active); if (RmlProcessParametersTableGroup != null) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index a18e4145e..243165cd5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -219,7 +219,7 @@ <ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter> </Border> - <materialDesign:PackIcon HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-2 -2 0 0" Width="12" Height="12" Kind="Settings"></materialDesign:PackIcon> + <materialDesign:PackIcon HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 0 0 0" Width="12" Height="12" Kind="Settings"></materialDesign:PackIcon> </Grid> </ControlTemplate> </Setter.Value> @@ -455,7 +455,7 @@ <Image Source="../Images/wind.png" Width="32"></Image> <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Winding Method</TextBlock> </StackPanel> - <ComboBox ItemsSource="{Binding Adapter.WindingMethods}" SelectedItem="{Binding SelectedJob.WindingMethods}" DisplayMemberPath="Name" ></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.WindingMethods}" SelectedItem="{Binding SelectedJob.WindingMethod}" DisplayMemberPath="Name" ></ComboBox> </StackPanel> </Border> @@ -736,7 +736,7 @@ </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> - <designer:MachineView IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> + <designer:MachineView Width="540" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> <Button Command="{Binding EditMachineCommand}" HorizontalAlignment="Right" Margin="0 10 20 20" Style="{StaticResource MaterialDesignFlatButton}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil"></materialDesign:PackIcon> @@ -790,12 +790,12 @@ <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> <StackPanel Margin="0 0 10 20"> - <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidTypes.Name}"></TextBlock> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> <Grid Width="60" Height="50" Margin="0 5 0 0"> <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> <shapes:Hexagon.Fill> <LinearGradientBrush Opacity="0.7" > - <GradientStop Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> <GradientStop Color="White" Offset="1"/> </LinearGradientBrush> </shapes:Hexagon.Fill> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 9f44bc270..5cb216a6c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -253,7 +253,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="applicationDisplayPanelVersion">The application display panel version.</param> public void DropTouchPanel(ApplicationDisplayPanelVersion applicationDisplayPanelVersion) { - Configuration.ApplicationDisplayPanelVersions = applicationDisplayPanelVersion; + Configuration.ApplicationDisplayPanelVersion = applicationDisplayPanelVersion; Configuration.ApplicationDisplayPanelVersionGuid = applicationDisplayPanelVersion.Guid; } @@ -263,7 +263,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="applicationFirmwareVersion">The application firmware version.</param> public void DropApplicationFirmwareVersion(ApplicationFirmwareVersion applicationFirmwareVersion) { - Configuration.ApplicationFirmwareVersions = applicationFirmwareVersion; + Configuration.ApplicationFirmwareVersion = applicationFirmwareVersion; Configuration.ApplicationFirmwareVersionGuid = applicationFirmwareVersion.Guid; } @@ -273,7 +273,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="applicationVersion">The application version.</param> public void DropApplicationVersion(ApplicationVersion applicationVersion) { - Configuration.ApplicationVersions = applicationVersion; + Configuration.ApplicationVersion = applicationVersion; Configuration.ApplicationVersionGuid = applicationVersion.Guid; } @@ -283,7 +283,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="hardwareVersion">The hardware version.</param> public void DropHardwareVersion(HardwareVersion hardwareVersion) { - Configuration.HardwareVersions = hardwareVersion; + Configuration.HardwareVersion = hardwareVersion; Configuration.HardwareVersionGuid = hardwareVersion.Guid; } @@ -293,7 +293,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="embeddedFirmwareVersion">The embedded firmware version.</param> public void DropEmbeddedFirmware(EmbeddedFirmwareVersion embeddedFirmwareVersion) { - Configuration.EmbeddedFirmwareVersions = embeddedFirmwareVersion; + Configuration.EmbeddedFirmwareVersion = embeddedFirmwareVersion; Configuration.EmbeddedFirmwareVersionGuid = embeddedFirmwareVersion.Guid; } @@ -303,7 +303,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="embeddedSoftwareVersion">The embedded software version.</param> public void DropEmbeddedSoftware(EmbeddedSoftwareVersion embeddedSoftwareVersion) { - Configuration.EmbeddedSoftwareVersions = embeddedSoftwareVersion; + Configuration.EmbeddedSoftwareVersion = embeddedSoftwareVersion; Configuration.EmbeddedSoftwareVersionGuid = embeddedSoftwareVersion.Guid; } @@ -313,7 +313,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="applicationOsVersion">The application os version.</param> public void DropApplicationOsVersion(ApplicationOsVersion applicationOsVersion) { - Configuration.ApplicationOsVersions = applicationOsVersion; + Configuration.ApplicationOsVersion = applicationOsVersion; Configuration.ApplicationVersionGuid = applicationOsVersion.Guid; } @@ -324,7 +324,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="idsPack">The ids pack.</param> public void DropCartridgeType(CartridgeType cartridgeType, IdsPack idsPack) { - idsPack.CartridgeTypes = cartridgeType; + idsPack.CartridgeType = cartridgeType; idsPack.CartridgeTypeGuid = cartridgeType.Guid; } @@ -335,7 +335,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="idsPack">The ids pack.</param> public void DropDispenserType(DispenserType dispenserType, IdsPack idsPack) { - idsPack.DispenserTypes = dispenserType; + idsPack.DispenserType = dispenserType; idsPack.DispenserTypeGuid = dispenserType.Guid; } @@ -346,7 +346,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="idsPack">The ids pack.</param> public void DropMidTankType(MidTankType midTankType, IdsPack idsPack) { - idsPack.MidTankTypes = midTankType; + idsPack.MidTankType = midTankType; idsPack.MidTankTypeGuid = midTankType.Guid; } @@ -357,7 +357,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// <param name="idsPack">The ids pack.</param> public void DropLiquidType(LiquidType liquidType, IdsPack idsPack) { - idsPack.LiquidTypes = liquidType; + idsPack.LiquidType = liquidType; idsPack.LiquidTypeGuid = liquidType.Guid; } @@ -399,7 +399,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels List<String> errors = new List<string>(); - if (Machine.MachineVersions == null) + if (Machine.MachineVersion == null) { errors.Add("Machine version is required."); } @@ -424,37 +424,37 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels errors.Add("Configuration name is required."); } - if (Configuration.ApplicationDisplayPanelVersions == null) + if (Configuration.ApplicationDisplayPanelVersion == null) { errors.Add("Touch Panel is required."); } - if (Configuration.ApplicationFirmwareVersions == null) + if (Configuration.ApplicationFirmwareVersion == null) { errors.Add("Application firmware is required."); } - if (Configuration.ApplicationOsVersions == null) + if (Configuration.ApplicationOsVersion == null) { errors.Add("Application operation system is required."); } - if (Configuration.ApplicationVersions == null) + if (Configuration.ApplicationVersion == null) { errors.Add("Application version is required."); } - if (Configuration.EmbeddedFirmwareVersions == null) + if (Configuration.EmbeddedFirmwareVersion == null) { errors.Add("Embedded firmware is required."); } - if (Configuration.EmbeddedSoftwareVersions == null) + if (Configuration.EmbeddedSoftwareVersion == null) { errors.Add("Embedded software is required."); } - if (Configuration.HardwareVersions == null) + if (Configuration.HardwareVersion == null) { errors.Add("Hardware version is required."); } @@ -466,19 +466,19 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels errors.Add(String.Format("Name is required on IDS pack number '{0}'.", Configuration.IdsPacks.IndexOf(pack) + 1)); continue; } - if (pack.CartridgeTypes == null) + if (pack.CartridgeType == null) { errors.Add(String.Format("Cartridge type is required on IDS pack '{0}'.", pack.Name)); } - if (pack.DispenserTypes == null) + if (pack.DispenserType == null) { errors.Add(String.Format("Dispenser type is required on IDS pack '{0}'.", pack.Name)); } - if (pack.LiquidTypes == null) + if (pack.LiquidType == null) { errors.Add(String.Format("Liquid type is required on IDS pack '{0}'.", pack.Name)); } - if (pack.MidTankTypes == null) + if (pack.MidTankType == null) { errors.Add(String.Format("Mid Tank type is required on IDS pack '{0}'.", pack.Name)); } @@ -582,9 +582,9 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// </summary> private void SetVersionConfiguration() { - if (Machine.MachineVersions != null) + if (Machine.MachineVersion != null) { - Configuration = Machine.MachineVersions.Configuration.CloneConfiguration(); + Configuration = Machine.MachineVersion.DefaultConfiguration.CloneConfiguration(); } else { @@ -605,8 +605,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { if (vm.SelectedVersion != null) { - vm.SelectedVersion.Configuration = Configuration.CloneConfiguration(); - vm.SelectedVersion.DefaultConfigurationGuid = vm.SelectedVersion.Configuration.Guid; + vm.SelectedVersion.DefaultConfiguration = Configuration.CloneConfiguration(); + vm.SelectedVersion.DefaultConfigurationGuid = vm.SelectedVersion.DefaultConfiguration.Guid; await vm.SelectedVersion.SaveAsync(); } else @@ -615,8 +615,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels newVersion.Version = vm.Version; newVersion.Name = vm.VersionName; - newVersion.Configuration = Configuration.CloneConfiguration(); - newVersion.DefaultConfigurationGuid = newVersion.Configuration.Guid; + newVersion.DefaultConfiguration = Configuration.CloneConfiguration(); + newVersion.DefaultConfigurationGuid = newVersion.DefaultConfiguration.Guid; await newVersion.SaveAsync(); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index a7e604352..691fa6987 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -57,8 +57,8 @@ <StackPanel Orientation="Horizontal"> <Image Source="../Images/hardware.png" Width="10" VerticalAlignment="Center" Margin="5" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" VerticalAlignment="Center" TextAlignment="Center" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.HardwareVersions.Name}"></Run> - <Run Text="{Binding Configuration.HardwareVersions.Version}"></Run> + <Run Text="{Binding Configuration.HardwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.HardwareVersion.Version}"></Run> </TextBlock> </StackPanel> </Border> @@ -105,7 +105,7 @@ </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> - <Grid dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}"> + <Grid dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" > <Grid.RowDefinitions> <RowDefinition Height="1*"/> <RowDefinition Height="30"/> @@ -123,7 +123,7 @@ <Image.Style> <Style TargetType="Image"> <Style.Triggers> - <DataTrigger Binding="{Binding DispenserTypes}" Value="{x:Null}"> + <DataTrigger Binding="{Binding DispenserType}" Value="{x:Null}"> <Setter Property="Opacity" Value="0.2"></Setter> </DataTrigger> </Style.Triggers> @@ -134,7 +134,7 @@ <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.8" Opacity="0.8"> <GradientStop Offset="0" Color="Transparent" /> - <GradientStop Offset="1" Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> @@ -145,7 +145,7 @@ <Image.Style> <Style TargetType="Image"> <Style.Triggers> - <DataTrigger Binding="{Binding MidTankTypes}" Value="{x:Null}"> + <DataTrigger Binding="{Binding MidTankType}" Value="{x:Null}"> <Setter Property="Opacity" Value="0.2"></Setter> </DataTrigger> </Style.Triggers> @@ -156,7 +156,7 @@ <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.8" Opacity="0.8"> <GradientStop Offset="0" Color="Transparent" /> - <GradientStop Offset="1" Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> @@ -167,7 +167,7 @@ <Grid.Style> <Style TargetType="Grid"> <Style.Triggers> - <DataTrigger Binding="{Binding CartridgeTypes}" Value="{x:Null}"> + <DataTrigger Binding="{Binding CartridgeType}" Value="{x:Null}"> <Setter Property="Opacity" Value="0.2"></Setter> </DataTrigger> </Style.Triggers> @@ -185,7 +185,7 @@ <Border.Background> <LinearGradientBrush Opacity="0.7"> <GradientStop Offset="0" Color="Transparent" /> - <GradientStop Offset="1" Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> </LinearGradientBrush> </Border.Background> </Border> @@ -228,13 +228,13 @@ <StackPanel Orientation="Horizontal"> <Image Source="../Images/embedded.png" Width="10" VerticalAlignment="Center" Margin="1" RenderOptions.BitmapScalingMode="Fant"></Image> - <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding Configuration.EmbeddedFirmwareVersions.Name}"/><Run Text=" "/><Run Text="{Binding Configuration.EmbeddedFirmwareVersions.Version}"/></TextBlock> + <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Name}"/><Run Text=" "/><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Version}"/></TextBlock> </StackPanel> <StackPanel Grid.Row="1" Orientation="Horizontal"> <Image Source="../Images/embedded-software.png" Width="10" VerticalAlignment="Center" Margin="1" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="1" IsHitTestVisible="False" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="14" Margin="0,6,0,1" Width="47"> - <Run Text="{Binding Configuration.EmbeddedSoftwareVersions.Name}"></Run> - <Run Text="{Binding Configuration.EmbeddedSoftwareVersions.Version}"></Run> + <Run Text="{Binding Configuration.EmbeddedSoftwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.EmbeddedSoftwareVersion.Version}"></Run> </TextBlock> </StackPanel> </Grid> @@ -290,16 +290,16 @@ <StackPanel> <Image Source="../Images/tablet.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationDisplayPanelVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationDisplayPanelVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Version}"></Run> </TextBlock> </StackPanel> <StackPanel Grid.Row="2" > <Image Source="../Images/app.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationVersion.Version}"></Run> </TextBlock> </StackPanel> @@ -307,16 +307,16 @@ <StackPanel Grid.Row="3" > <Image Source="../Images/application-firmware.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationFirmwareVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationFirmwareVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Version}"></Run> </TextBlock> </StackPanel> <StackPanel Grid.Row="1" > <Image Source="../Images/android.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationOsVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationOsVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationOsVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationOsVersion.Version}"></Run> </TextBlock> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index 605b66a05..e442e0e6f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -123,8 +123,8 @@ <StackPanel Orientation="Horizontal"> <Image Source="../Images/hardware.png" Width="10" VerticalAlignment="Center" Margin="5" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" VerticalAlignment="Center" TextAlignment="Center" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.HardwareVersions.Name}"></Run> - <Run Text="{Binding Configuration.HardwareVersions.Version}"></Run> + <Run Text="{Binding Configuration.HardwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.HardwareVersion.Version}"></Run> </TextBlock> </StackPanel> </Border> @@ -189,7 +189,7 @@ <Image.Style> <Style TargetType="Image"> <Style.Triggers> - <DataTrigger Binding="{Binding DispenserTypes}" Value="{x:Null}"> + <DataTrigger Binding="{Binding DispenserType}" Value="{x:Null}"> <Setter Property="Opacity" Value="0.2"></Setter> </DataTrigger> </Style.Triggers> @@ -200,7 +200,7 @@ <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.8" Opacity="0.8"> <GradientStop Offset="0" Color="Transparent" /> - <GradientStop Offset="1" Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> @@ -211,7 +211,7 @@ <Image.Style> <Style TargetType="Image"> <Style.Triggers> - <DataTrigger Binding="{Binding MidTankTypes}" Value="{x:Null}"> + <DataTrigger Binding="{Binding MidTankType}" Value="{x:Null}"> <Setter Property="Opacity" Value="0.2"></Setter> </DataTrigger> </Style.Triggers> @@ -222,7 +222,7 @@ <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.8" Opacity="0.8"> <GradientStop Offset="0" Color="Transparent" /> - <GradientStop Offset="1" Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> @@ -233,7 +233,7 @@ <Grid.Style> <Style TargetType="Grid"> <Style.Triggers> - <DataTrigger Binding="{Binding CartridgeTypes}" Value="{x:Null}"> + <DataTrigger Binding="{Binding CartridgeType}" Value="{x:Null}"> <Setter Property="Opacity" Value="0.2"></Setter> </DataTrigger> </Style.Triggers> @@ -251,7 +251,7 @@ <Border.Background> <LinearGradientBrush Opacity="0.7"> <GradientStop Offset="0" Color="Transparent" /> - <GradientStop Offset="1" Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> </LinearGradientBrush> </Border.Background> </Border> @@ -294,13 +294,13 @@ <StackPanel Orientation="Horizontal"> <Image Source="../Images/embedded.png" Width="10" VerticalAlignment="Center" Margin="1" RenderOptions.BitmapScalingMode="Fant"></Image> - <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding Configuration.EmbeddedFirmwareVersions.Name}"/><Run Text=" "/><Run Text="{Binding Configuration.EmbeddedFirmwareVersions.Version}"/></TextBlock> + <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Name}"/><Run Text=" "/><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Version}"/></TextBlock> </StackPanel> <StackPanel Grid.Row="1" Orientation="Horizontal"> <Image Source="../Images/embedded-software.png" Width="10" VerticalAlignment="Center" Margin="1" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="1" IsHitTestVisible="False" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="14" Margin="0,6,0,1" Width="47"> - <Run Text="{Binding Configuration.EmbeddedSoftwareVersions.Name}"></Run> - <Run Text="{Binding Configuration.EmbeddedSoftwareVersions.Version}"></Run> + <Run Text="{Binding Configuration.EmbeddedSoftwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.EmbeddedSoftwareVersion.Version}"></Run> </TextBlock> </StackPanel> </Grid> @@ -356,16 +356,16 @@ <StackPanel> <Image Source="../Images/tablet.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationDisplayPanelVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationDisplayPanelVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Version}"></Run> </TextBlock> </StackPanel> <StackPanel Grid.Row="2" > <Image Source="../Images/app.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationVersion.Version}"></Run> </TextBlock> </StackPanel> @@ -373,16 +373,16 @@ <StackPanel Grid.Row="3" > <Image Source="../Images/application-firmware.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationFirmwareVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationFirmwareVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Version}"></Run> </TextBlock> </StackPanel> <StackPanel Grid.Row="1" > <Image Source="../Images/android.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> - <Run Text="{Binding Configuration.ApplicationOsVersions.Name}"></Run> - <Run Text="{Binding Configuration.ApplicationOsVersions.Version}"></Run> + <Run Text="{Binding Configuration.ApplicationOsVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationOsVersion.Version}"></Run> </TextBlock> </StackPanel> </Grid> @@ -403,19 +403,19 @@ <StackPanel Margin="20 0 0 0"> <StackPanel Orientation="Horizontal" Margin="0 3 0 3"> <Image RenderOptions.BitmapScalingMode="Fant" Source="../Images/injection.png" Width="12" VerticalAlignment="Center"></Image> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Dispenser:</Run> <Run FontStyle="Italic" Text="{Binding DispenserTypes.Name}"></Run></TextBlock> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Dispenser:</Run> <Run FontStyle="Italic" Text="{Binding DispenserType.Name}"></Run></TextBlock> </StackPanel> <StackPanel Orientation="Horizontal" Margin="0 3 0 3"> <Image RenderOptions.BitmapScalingMode="Fant" Source="../Images/tank.png" Width="12" VerticalAlignment="Center"></Image> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Mid Tank:</Run> <Run FontStyle="Italic" Text="{Binding MidTankTypes.Name}"></Run></TextBlock> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Mid Tank:</Run> <Run FontStyle="Italic" Text="{Binding MidTankType.Name}"></Run></TextBlock> </StackPanel> <StackPanel Orientation="Horizontal" Margin="0 3 0 3"> <Image RenderOptions.BitmapScalingMode="Fant" Source="../Images/cartridge.png" Width="12" VerticalAlignment="Center"></Image> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Cartridge:</Run> <Run FontStyle="Italic" Text="{Binding CartridgeTypes.Name}"></Run></TextBlock> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Cartridge:</Run> <Run FontStyle="Italic" Text="{Binding CartridgeType.Name}"></Run></TextBlock> </StackPanel> <StackPanel Orientation="Horizontal" Margin="0 3 0 3"> <Image RenderOptions.BitmapScalingMode="Fant" Source="../Images/liquid.png" Width="12" VerticalAlignment="Center"></Image> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Liquid:</Run> <Run FontStyle="Italic" Text="{Binding LiquidTypes.Name}"></Run></TextBlock> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Liquid:</Run> <Run FontStyle="Italic" Text="{Binding LiquidType.Name}"></Run></TextBlock> </StackPanel> </StackPanel> </StackPanel> @@ -452,7 +452,7 @@ <ColumnDefinition Width="1*"></ColumnDefinition> <ColumnDefinition Width="80"></ColumnDefinition> </Grid.ColumnDefinitions> - <ComboBox ItemsSource="{Binding Adapter.MachineVersions}" SelectedItem="{Binding Machine.MachineVersions}" DisplayMemberPath="Name"></ComboBox> + <ComboBox ItemsSource="{Binding Adapter.MachineVersions}" SelectedItem="{Binding Machine.MachineVersion}" DisplayMemberPath="Name"></ComboBox> <Button Grid.Column="1" Command="{Binding SetVersionConfigurationCommand}" Height="25" Margin="10 2 2 2" ToolTip="Sets the current configuration to the selected machine version default configuration">SET</Button> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index af3715a40..3c6f70e1b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -11,29 +11,31 @@ Title="Tango" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> <Grid> - <!--<Viewbox Stretch="Fill" UseLayoutRounding="True" SnapsToDevicePixels="True">--> - <Grid> - <sharedControls:MultiTransitionControl AlwaysFade="True" TransitionType="Zoom" x:Name="TransitionControl" x:FieldModifier="public"> - <sharedControls:MultiTransitionControl.Controls> - <ContentControl Tag="LoadingView"> - <views:LoadingView></views:LoadingView> - </ContentControl> - <ContentControl Tag="LoginView"> - <views:LoginView></views:LoginView> - </ContentControl> - <ContentControl Tag="MainView"> - <views:MainView></views:MainView> - </ContentControl> - <ContentControl Tag="ShutdownView"> - <views:ShutdownView></views:ShutdownView> - </ContentControl> - </sharedControls:MultiTransitionControl.Controls> - </sharedControls:MultiTransitionControl> + <Viewbox Stretch="Fill" UseLayoutRounding="True" SnapsToDevicePixels="True"> + <Grid Width="1920" Height="1145"> + <Grid> + <sharedControls:MultiTransitionControl AlwaysFade="True" TransitionType="Zoom" x:Name="TransitionControl" x:FieldModifier="public"> + <sharedControls:MultiTransitionControl.Controls> + <ContentControl Tag="LoadingView"> + <views:LoadingView></views:LoadingView> + </ContentControl> + <ContentControl Tag="LoginView"> + <views:LoginView></views:LoginView> + </ContentControl> + <ContentControl Tag="MainView"> + <views:MainView></views:MainView> + </ContentControl> + <ContentControl Tag="ShutdownView"> + <views:ShutdownView></views:ShutdownView> + </ContentControl> + </sharedControls:MultiTransitionControl.Controls> + </sharedControls:MultiTransitionControl> - <Grid Background="Black" Opacity="0.7" x:Name="shadowGrid" Visibility="Hidden"> + <Grid Background="Black" Opacity="0.7" x:Name="shadowGrid" Visibility="Hidden"> + </Grid> </Grid> </Grid> - <!--</Viewbox>--> + </Viewbox> </Grid> </mahapps:MetroWindow> diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs index bc0f37929..ad91e8117 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs +++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFile.cs @@ -62,6 +62,12 @@ namespace Tango.CodeGeneration /// </summary> public String Description { get; set; } + public bool IsForeignKey { get; set; } + + public String ForeignKeyName { get; set; } + + public bool Complex { get; set; } + /// <summary> /// Gets or sets a value indicating whether to initialize this field in the constructor. /// </summary> diff --git a/Software/Visual_Studio/Tango.CodeGeneration/ObservablesContextCodeFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/ObservablesContextCodeFile.cs new file mode 100644 index 000000000..618af0916 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/ObservablesContextCodeFile.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class ObservablesContextCodeFile : Class + { + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj index 1c491813a..ff9072a1a 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj +++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj @@ -67,6 +67,7 @@ <Compile Include="EntityCodeFileJava.cs" /> <Compile Include="EntityCodeFile.cs" /> <Compile Include="EnumerationField.cs" /> + <Compile Include="ObservablesContextCodeFile.cs" /> <Compile Include="TangoDAOJavaFile.cs" /> <Compile Include="EnumerationFileJava.cs" /> <Compile Include="EnumerationFile.cs" /> @@ -104,6 +105,7 @@ <EmbeddedResource Include="Templates\EntityCodeFileJava.cshtml" /> <EmbeddedResource Include="Templates\EnumerationFileJava.cshtml" /> <EmbeddedResource Include="Templates\TangoDAOJavaFile.cshtml" /> + <EmbeddedResource Include="Templates\ObservablesContextCodeFile.cshtml" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- 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 709da7dda..001a2bb3f 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFile.cshtml @@ -1,13 +1,15 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("@(Model.TableName)")] - public partial class @(Model.Name) : ObservableEntity<@(Model.EntityName)> + [Table("@(Model.TableName)")] + public partial class @(Model.Name) : ObservableEntity { @foreach (var prop in Model.Fields) { @@ -16,8 +18,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the @(Model.Name.ToLower()) @(prop.Description). /// </summary> - [EntityFieldName("@(prop.FieldName)")] - public @(prop.Type) @(prop.Name) + @(!prop.Construct && !prop.Complex ? "[Column(\"" + prop.FieldName + "\")]" : "") + @(prop.IsForeignKey ? "[ForeignKey(\"" + prop.ForeignKeyName + "\")]" : "") + public @(prop.Construct || prop.Complex ? "virtual" : "") @(prop.Type) @(prop.Name) { get { return _@(prop.Name.ToLower()); } set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); } @@ -30,31 +33,13 @@ namespace Tango.DAL.Observables /// </summary> public @(Model.Name)() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="@(Model.Name)" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public @(Model.Name)(@(Model.EntityName) entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { @foreach (var prop in Model.Fields) { if (prop.Construct) - { - <div> - @(prop.Name) = new @(prop.Type)(); - </div> + { + <div> + @(prop.Name) = new @(prop.Type)(); + </div> } } } diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml new file mode 100644 index 000000000..43330235c --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesContextCodeFile.cshtml @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.DAL.Observables +{ + public class ObservablesContext : DbContext + { + /// <summary> + /// Initializes a new instance of the <see cref="ObservablesContext" /> class. + /// </summary> + /// <param name="path">The server file path.</param> + /// <param name="isFile">if set to <c>true</c> will try to connect to an .mdf file.</param> + public ObservablesContext(String path, bool isFile) : base(ComposeConnectionString(path, isFile)) + { + + } + + /// <summary> + /// Composes the connection string. + ///</summary> + /// <param name="source">The source.</param> + /// <param name="isFile">if set to <c>true</c> [is file].</param> + /// <returns></returns> + private static String ComposeConnectionString(String source, bool isFile) + { + if (!isFile) + { + return String.Format("Data Source={0};Initial Catalog=Tango;Integrated Security=true", source); + } + else + { + return null; + } + } + + /// <summary> + /// Creates a default remote database context by the address specified in <see cref="SettingsManager.Default.DataBase.SQLServerAddress" />. + /// </summary> + /// <returns></returns> + public static ObservablesContext CreateDefault() + { + return new ObservablesContext(SettingsManager.Default.DataBase.SQLServerAddress, false); + } + + @foreach (var prop in Model.Properties) + { + <div> + /// <summary> + /// Gets or sets the @(prop.Name). + /// </summary> + public @(prop.Type) @(prop.Name) { get; set; } + </div> + } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ActionType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ActionType.cs index 2d26c8e76..ffdde45d3 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ActionType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ActionType.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("ACTION_TYPES")] - public partial class ActionType : ObservableEntity<ACTION_TYPES> + [Table("ACTION_TYPES")] + public partial class ActionType : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the actiontype code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the actiontype name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the actiontype description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the actiontype event types actions. /// </summary> - [EntityFieldName("EVENT_TYPES_ACTIONS")] - public ObservableCollection<EventTypesAction> EventTypesActions + + public virtual ObservableCollection<EventTypesAction> EventTypesActions { get { @@ -91,24 +96,6 @@ namespace Tango.DAL.Observables /// </summary> public ActionType() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ActionType" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ActionType(ACTION_TYPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { EventTypesActions = new ObservableCollection<EventTypesAction>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Address.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Address.cs index 020c3a3c2..f2ba8d4e4 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Address.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Address.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("ADDRESSES")] - public partial class Address : ObservableEntity<ADDRESS> + [Table("ADDRESSES")] + public partial class Address : ObservableEntity { private Boolean _deleted; /// <summary> /// Gets or sets the address deleted. /// </summary> - [EntityFieldName("DELETED")] - public Boolean Deleted + [Column("DELETED")] + + public Boolean Deleted { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address address string. /// </summary> - [EntityFieldName("ADDRESS_STRING")] - public String AddressString + [Column("ADDRESS_STRING")] + + public String AddressString { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address locality. /// </summary> - [EntityFieldName("LOCALITY")] - public String Locality + [Column("LOCALITY")] + + public String Locality { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address country. /// </summary> - [EntityFieldName("COUNTRY")] - public String Country + [Column("COUNTRY")] + + public String Country { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address city. /// </summary> - [EntityFieldName("CITY")] - public String City + [Column("CITY")] + + public String City { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address state. /// </summary> - [EntityFieldName("STATE")] - public String State + [Column("STATE")] + + public String State { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address country code. /// </summary> - [EntityFieldName("COUNTRY_CODE")] - public String CountryCode + [Column("COUNTRY_CODE")] + + public String CountryCode { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address postal code. /// </summary> - [EntityFieldName("POSTAL_CODE")] - public String PostalCode + [Column("POSTAL_CODE")] + + public String PostalCode { get { @@ -166,8 +176,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address organizations. /// </summary> - [EntityFieldName("ORGANIZATIONS")] - public ObservableCollection<Organization> Organizations + + public virtual ObservableCollection<Organization> Organizations { get { @@ -185,8 +195,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the address users. /// </summary> - [EntityFieldName("USERS")] - public ObservableCollection<User> Users + + public virtual ObservableCollection<User> Users { get { @@ -205,24 +215,6 @@ namespace Tango.DAL.Observables /// </summary> public Address() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Address" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Address(ADDRESS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Organizations = new ObservableCollection<Organization>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs index 851f891d6..1f56718d1 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("APPLICATION_DISPLAY_PANEL_VERSIONS")] - public partial class ApplicationDisplayPanelVersion : ObservableEntity<APPLICATION_DISPLAY_PANEL_VERSIONS> + [Table("APPLICATION_DISPLAY_PANEL_VERSIONS")] + public partial class ApplicationDisplayPanelVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the applicationdisplaypanelversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationdisplaypanelversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationdisplaypanelversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public ApplicationDisplayPanelVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ApplicationDisplayPanelVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ApplicationDisplayPanelVersion(APPLICATION_DISPLAY_PANEL_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs index c0a9893bb..5c5f44205 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("APPLICATION_FIRMWARE_VERSIONS")] - public partial class ApplicationFirmwareVersion : ObservableEntity<APPLICATION_FIRMWARE_VERSIONS> + [Table("APPLICATION_FIRMWARE_VERSIONS")] + public partial class ApplicationFirmwareVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the applicationfirmwareversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationfirmwareversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationfirmwareversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public ApplicationFirmwareVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ApplicationFirmwareVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ApplicationFirmwareVersion(APPLICATION_FIRMWARE_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs index a4d311ec1..b4cff06e9 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("APPLICATION_OS_VERSIONS")] - public partial class ApplicationOsVersion : ObservableEntity<APPLICATION_OS_VERSIONS> + [Table("APPLICATION_OS_VERSIONS")] + public partial class ApplicationOsVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the applicationosversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationosversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationosversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public ApplicationOsVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ApplicationOsVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ApplicationOsVersion(APPLICATION_OS_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs index 758f42398..98f8a1e7f 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("APPLICATION_VERSIONS")] - public partial class ApplicationVersion : ObservableEntity<APPLICATION_VERSIONS> + [Table("APPLICATION_VERSIONS")] + public partial class ApplicationVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the applicationversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the applicationversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public ApplicationVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ApplicationVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ApplicationVersion(APPLICATION_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/BrushStop.cs index 3010c16d1..4646f3178 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/BrushStop.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("BRUSH_STOPS")] - public partial class BrushStop : ObservableEntity<BRUSH_STOPS> + [Table("BRUSH_STOPS")] + public partial class BrushStop : ObservableEntity { private String _segmentguid; /// <summary> /// Gets or sets the brushstop segment guid. /// </summary> - [EntityFieldName("SEGMENT_GUID")] - public String SegmentGuid + [Column("SEGMENT_GUID")] + [ForeignKey("Segment")] + public String SegmentGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop color space guid. /// </summary> - [EntityFieldName("COLOR_SPACE_GUID")] - public String ColorSpaceGuid + [Column("COLOR_SPACE_GUID")] + [ForeignKey("ColorSpace")] + public String ColorSpaceGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop offset percent. /// </summary> - [EntityFieldName("OFFSET_PERCENT")] - public Double OffsetPercent + [Column("OFFSET_PERCENT")] + + public Double OffsetPercent { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop cyan. /// </summary> - [EntityFieldName("CYAN")] - public Double Cyan + [Column("CYAN")] + + public Double Cyan { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop magenta. /// </summary> - [EntityFieldName("MAGENTA")] - public Double Magenta + [Column("MAGENTA")] + + public Double Magenta { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop yellow. /// </summary> - [EntityFieldName("YELLOW")] - public Double Yellow + [Column("YELLOW")] + + public Double Yellow { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop black. /// </summary> - [EntityFieldName("BLACK")] - public Double Black + [Column("BLACK")] + + public Double Black { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop red. /// </summary> - [EntityFieldName("RED")] - public Int32 Red + [Column("RED")] + + public Int32 Red { get { @@ -166,8 +176,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop green. /// </summary> - [EntityFieldName("GREEN")] - public Int32 Green + [Column("GREEN")] + + public Int32 Green { get { @@ -185,8 +196,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop blue. /// </summary> - [EntityFieldName("BLUE")] - public Int32 Blue + [Column("BLUE")] + + public Int32 Blue { get { @@ -204,8 +216,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop l. /// </summary> - [EntityFieldName("L")] - public Int32 L + [Column("L")] + + public Int32 L { get { @@ -223,8 +236,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop a. /// </summary> - [EntityFieldName("A")] - public Int32 A + [Column("A")] + + public Int32 A { get { @@ -242,8 +256,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop b. /// </summary> - [EntityFieldName("B")] - public Int32 B + [Column("B")] + + public Int32 B { get { @@ -261,8 +276,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop panton guid. /// </summary> - [EntityFieldName("PANTON_GUID")] - public String PantonGuid + [Column("PANTON_GUID")] + public String PantonGuid { get { @@ -276,21 +291,21 @@ namespace Tango.DAL.Observables } - private ColorSpace _colorspaces; + private ColorSpace _colorspace; /// <summary> /// Gets or sets the brushstop color spaces. /// </summary> - [EntityFieldName("COLOR_SPACES")] - public ColorSpace ColorSpaces + + public virtual ColorSpace ColorSpace { get { - return _colorspaces; + return _colorspace; } set { - _colorspaces = value; RaisePropertyChanged(nameof(ColorSpaces)); + _colorspace = value; RaisePropertyChanged(nameof(ColorSpace)); } } @@ -299,8 +314,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the brushstop segment. /// </summary> - [EntityFieldName("SEGMENT")] - public Segment Segment + + public virtual Segment Segment { get { @@ -319,24 +334,6 @@ namespace Tango.DAL.Observables /// </summary> public BrushStop() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="BrushStop" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public BrushStop(BRUSH_STOPS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs index d870d3e29..28dab4039 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("CARTRIDGE_TYPES")] - public partial class CartridgeType : ObservableEntity<CARTRIDGE_TYPES> + [Table("CARTRIDGE_TYPES")] + public partial class CartridgeType : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the cartridgetype code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cartridgetype name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cartridgetype ids packs. /// </summary> - [EntityFieldName("IDS_PACKS")] - public ObservableCollection<IdsPack> IdsPacks + + public virtual ObservableCollection<IdsPack> IdsPacks { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public CartridgeType() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="CartridgeType" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public CartridgeType(CARTRIDGE_TYPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { IdsPacks = new ObservableCollection<IdsPack>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cat.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cat.cs index 0b1128e51..0ffaacfd8 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cat.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cat.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("CATS")] - public partial class Cat : ObservableEntity<CAT> + [Table("CATS")] + public partial class Cat : ObservableEntity { private String _name; /// <summary> /// Gets or sets the cat name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cat liquid type guid. /// </summary> - [EntityFieldName("LIQUID_TYPE_GUID")] - public String LiquidTypeGuid + [Column("LIQUID_TYPE_GUID")] + [ForeignKey("LiquidType")] + public String LiquidTypeGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cat rml guid. /// </summary> - [EntityFieldName("RML_GUID")] - public String RmlGuid + [Column("RML_GUID")] + [ForeignKey("Rml")] + public String RmlGuid { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cat data. /// </summary> - [EntityFieldName("DATA")] - public Byte[] Data + [Column("DATA")] + + public Byte[] Data { get { @@ -86,21 +92,21 @@ namespace Tango.DAL.Observables } - private LiquidType _liquidtypes; + private LiquidType _liquidtype; /// <summary> /// Gets or sets the cat liquid types. /// </summary> - [EntityFieldName("LIQUID_TYPES")] - public LiquidType LiquidTypes + + public virtual LiquidType LiquidType { get { - return _liquidtypes; + return _liquidtype; } set { - _liquidtypes = value; RaisePropertyChanged(nameof(LiquidTypes)); + _liquidtype = value; RaisePropertyChanged(nameof(LiquidType)); } } @@ -109,8 +115,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cat rml. /// </summary> - [EntityFieldName("RML")] - public Rml Rml + + public virtual Rml Rml { get { @@ -129,24 +135,6 @@ namespace Tango.DAL.Observables /// </summary> public Cat() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Cat" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Cat(CAT entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cct.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cct.cs index 679fd08dd..737d3e127 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cct.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cct.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("CCTS")] - public partial class Cct : ObservableEntity<CCT> + [Table("CCTS")] + public partial class Cct : ObservableEntity { private String _name; /// <summary> /// Gets or sets the cct name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct forward file name. /// </summary> - [EntityFieldName("FORWARD_FILE_NAME")] - public String ForwardFileName + [Column("FORWARD_FILE_NAME")] + + public String ForwardFileName { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct inverse file name. /// </summary> - [EntityFieldName("INVERSE_FILE_NAME")] - public String InverseFileName + [Column("INVERSE_FILE_NAME")] + + public String InverseFileName { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct forward data. /// </summary> - [EntityFieldName("FORWARD_DATA")] - public Byte[] ForwardData + [Column("FORWARD_DATA")] + + public Byte[] ForwardData { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct inverse data. /// </summary> - [EntityFieldName("INVERSE_DATA")] - public Byte[] InverseData + [Column("INVERSE_DATA")] + + public Byte[] InverseData { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct rml guid. /// </summary> - [EntityFieldName("RML_GUID")] - public String RmlGuid + [Column("RML_GUID")] + [ForeignKey("Rml")] + public String RmlGuid { get { @@ -166,8 +176,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the cct rml. /// </summary> - [EntityFieldName("RML")] - public Rml Rml + + public virtual Rml Rml { get { @@ -186,24 +196,6 @@ namespace Tango.DAL.Observables /// </summary> public Cct() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Cct" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Cct(CCT entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ColorSpace.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ColorSpace.cs index a68e8f8c3..de99fb775 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ColorSpace.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ColorSpace.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("COLOR_SPACES")] - public partial class ColorSpace : ObservableEntity<COLOR_SPACES> + [Table("COLOR_SPACES")] + public partial class ColorSpace : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the colorspace code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the colorspace name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the colorspace description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the colorspace brush stops. /// </summary> - [EntityFieldName("BRUSH_STOPS")] - public ObservableCollection<BrushStop> BrushStops + + public virtual ObservableCollection<BrushStop> BrushStops { get { @@ -91,24 +96,6 @@ namespace Tango.DAL.Observables /// </summary> public ColorSpace() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ColorSpace" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ColorSpace(COLOR_SPACES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { BrushStops = new ObservableCollection<BrushStop>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs index 8433f6d92..999491915 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("CONFIGURATIONS")] - public partial class Configuration : ObservableEntity<CONFIGURATION> + [Table("CONFIGURATIONS")] + public partial class Configuration : ObservableEntity { private String _name; /// <summary> /// Gets or sets the configuration name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration creation date. /// </summary> - [EntityFieldName("CREATION_DATE")] - public DateTime CreationDate + [Column("CREATION_DATE")] + + public DateTime CreationDate { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration application version guid. /// </summary> - [EntityFieldName("APPLICATION_VERSION_GUID")] - public String ApplicationVersionGuid + [Column("APPLICATION_VERSION_GUID")] + [ForeignKey("ApplicationVersion")] + public String ApplicationVersionGuid { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration application os version guid. /// </summary> - [EntityFieldName("APPLICATION_OS_VERSION_GUID")] - public String ApplicationOsVersionGuid + [Column("APPLICATION_OS_VERSION_GUID")] + [ForeignKey("ApplicationOsVersion")] + public String ApplicationOsVersionGuid { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration application firmware version guid. /// </summary> - [EntityFieldName("APPLICATION_FIRMWARE_VERSION_GUID")] - public String ApplicationFirmwareVersionGuid + [Column("APPLICATION_FIRMWARE_VERSION_GUID")] + [ForeignKey("ApplicationFirmwareVersion")] + public String ApplicationFirmwareVersionGuid { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration application display panel version guid. /// </summary> - [EntityFieldName("APPLICATION_DISPLAY_PANEL_VERSION_GUID")] - public String ApplicationDisplayPanelVersionGuid + [Column("APPLICATION_DISPLAY_PANEL_VERSION_GUID")] + [ForeignKey("ApplicationDisplayPanelVersion")] + public String ApplicationDisplayPanelVersionGuid { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration embedded firmware version guid. /// </summary> - [EntityFieldName("EMBEDDED_FIRMWARE_VERSION_GUID")] - public String EmbeddedFirmwareVersionGuid + [Column("EMBEDDED_FIRMWARE_VERSION_GUID")] + [ForeignKey("EmbeddedFirmwareVersion")] + public String EmbeddedFirmwareVersionGuid { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration embedded software version guid. /// </summary> - [EntityFieldName("EMBEDDED_SOFTWARE_VERSION_GUID")] - public String EmbeddedSoftwareVersionGuid + [Column("EMBEDDED_SOFTWARE_VERSION_GUID")] + [ForeignKey("EmbeddedSoftwareVersion")] + public String EmbeddedSoftwareVersionGuid { get { @@ -166,8 +176,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration hardware version guid. /// </summary> - [EntityFieldName("HARDWARE_VERSION_GUID")] - public String HardwareVersionGuid + [Column("HARDWARE_VERSION_GUID")] + [ForeignKey("HardwareVersion")] + public String HardwareVersionGuid { get { @@ -181,135 +192,135 @@ namespace Tango.DAL.Observables } - private ApplicationDisplayPanelVersion _applicationdisplaypanelversions; + private ApplicationDisplayPanelVersion _applicationdisplaypanelversion; /// <summary> /// Gets or sets the configuration application display panel versions. /// </summary> - [EntityFieldName("APPLICATION_DISPLAY_PANEL_VERSIONS")] - public ApplicationDisplayPanelVersion ApplicationDisplayPanelVersions + + public virtual ApplicationDisplayPanelVersion ApplicationDisplayPanelVersion { get { - return _applicationdisplaypanelversions; + return _applicationdisplaypanelversion; } set { - _applicationdisplaypanelversions = value; RaisePropertyChanged(nameof(ApplicationDisplayPanelVersions)); + _applicationdisplaypanelversion = value; RaisePropertyChanged(nameof(ApplicationDisplayPanelVersion)); } } - private ApplicationFirmwareVersion _applicationfirmwareversions; + private ApplicationFirmwareVersion _applicationfirmwareversion; /// <summary> /// Gets or sets the configuration application firmware versions. /// </summary> - [EntityFieldName("APPLICATION_FIRMWARE_VERSIONS")] - public ApplicationFirmwareVersion ApplicationFirmwareVersions + + public virtual ApplicationFirmwareVersion ApplicationFirmwareVersion { get { - return _applicationfirmwareversions; + return _applicationfirmwareversion; } set { - _applicationfirmwareversions = value; RaisePropertyChanged(nameof(ApplicationFirmwareVersions)); + _applicationfirmwareversion = value; RaisePropertyChanged(nameof(ApplicationFirmwareVersion)); } } - private ApplicationOsVersion _applicationosversions; + private ApplicationOsVersion _applicationosversion; /// <summary> /// Gets or sets the configuration application os versions. /// </summary> - [EntityFieldName("APPLICATION_OS_VERSIONS")] - public ApplicationOsVersion ApplicationOsVersions + + public virtual ApplicationOsVersion ApplicationOsVersion { get { - return _applicationosversions; + return _applicationosversion; } set { - _applicationosversions = value; RaisePropertyChanged(nameof(ApplicationOsVersions)); + _applicationosversion = value; RaisePropertyChanged(nameof(ApplicationOsVersion)); } } - private ApplicationVersion _applicationversions; + private ApplicationVersion _applicationversion; /// <summary> /// Gets or sets the configuration application versions. /// </summary> - [EntityFieldName("APPLICATION_VERSIONS")] - public ApplicationVersion ApplicationVersions + + public virtual ApplicationVersion ApplicationVersion { get { - return _applicationversions; + return _applicationversion; } set { - _applicationversions = value; RaisePropertyChanged(nameof(ApplicationVersions)); + _applicationversion = value; RaisePropertyChanged(nameof(ApplicationVersion)); } } - private EmbeddedFirmwareVersion _embeddedfirmwareversions; + private EmbeddedFirmwareVersion _embeddedfirmwareversion; /// <summary> /// Gets or sets the configuration embedded firmware versions. /// </summary> - [EntityFieldName("EMBEDDED_FIRMWARE_VERSIONS")] - public EmbeddedFirmwareVersion EmbeddedFirmwareVersions + + public virtual EmbeddedFirmwareVersion EmbeddedFirmwareVersion { get { - return _embeddedfirmwareversions; + return _embeddedfirmwareversion; } set { - _embeddedfirmwareversions = value; RaisePropertyChanged(nameof(EmbeddedFirmwareVersions)); + _embeddedfirmwareversion = value; RaisePropertyChanged(nameof(EmbeddedFirmwareVersion)); } } - private EmbeddedSoftwareVersion _embeddedsoftwareversions; + private EmbeddedSoftwareVersion _embeddedsoftwareversion; /// <summary> /// Gets or sets the configuration embedded software versions. /// </summary> - [EntityFieldName("EMBEDDED_SOFTWARE_VERSIONS")] - public EmbeddedSoftwareVersion EmbeddedSoftwareVersions + + public virtual EmbeddedSoftwareVersion EmbeddedSoftwareVersion { get { - return _embeddedsoftwareversions; + return _embeddedsoftwareversion; } set { - _embeddedsoftwareversions = value; RaisePropertyChanged(nameof(EmbeddedSoftwareVersions)); + _embeddedsoftwareversion = value; RaisePropertyChanged(nameof(EmbeddedSoftwareVersion)); } } - private HardwareVersion _hardwareversions; + private HardwareVersion _hardwareversion; /// <summary> /// Gets or sets the configuration hardware versions. /// </summary> - [EntityFieldName("HARDWARE_VERSIONS")] - public HardwareVersion HardwareVersions + + public virtual HardwareVersion HardwareVersion { get { - return _hardwareversions; + return _hardwareversion; } set { - _hardwareversions = value; RaisePropertyChanged(nameof(HardwareVersions)); + _hardwareversion = value; RaisePropertyChanged(nameof(HardwareVersion)); } } @@ -318,8 +329,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration ids packs. /// </summary> - [EntityFieldName("IDS_PACKS")] - public ObservableCollection<IdsPack> IdsPacks + + public virtual ObservableCollection<IdsPack> IdsPacks { get { @@ -337,8 +348,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration machine versions. /// </summary> - [EntityFieldName("MACHINE_VERSIONS")] - public ObservableCollection<MachineVersion> MachineVersions + + public virtual ObservableCollection<MachineVersion> MachineVersions { get { @@ -356,8 +367,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration machines. /// </summary> - [EntityFieldName("MACHINES")] - public ObservableCollection<Machine> Machines + + public virtual ObservableCollection<Machine> Machines { get { @@ -375,8 +386,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the configuration machines configurations. /// </summary> - [EntityFieldName("MACHINES_CONFIGURATIONS")] - public ObservableCollection<MachinesConfiguration> MachinesConfigurations + + public virtual ObservableCollection<MachinesConfiguration> MachinesConfigurations { get { @@ -395,24 +406,6 @@ namespace Tango.DAL.Observables /// </summary> public Configuration() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Configuration" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Configuration(CONFIGURATION entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { IdsPacks = new ObservableCollection<IdsPack>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Contact.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Contact.cs index 0356d44b5..ad95c490d 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Contact.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Contact.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("CONTACTS")] - public partial class Contact : ObservableEntity<CONTACT> + [Table("CONTACTS")] + public partial class Contact : ObservableEntity { private Boolean _deleted; /// <summary> /// Gets or sets the contact deleted. /// </summary> - [EntityFieldName("DELETED")] - public Boolean Deleted + [Column("DELETED")] + + public Boolean Deleted { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact first name. /// </summary> - [EntityFieldName("FIRST_NAME")] - public String FirstName + [Column("FIRST_NAME")] + + public String FirstName { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact last name. /// </summary> - [EntityFieldName("LAST_NAME")] - public String LastName + [Column("LAST_NAME")] + + public String LastName { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact full name. /// </summary> - [EntityFieldName("FULL_NAME")] - public String FullName + [Column("FULL_NAME")] + + public String FullName { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact email. /// </summary> - [EntityFieldName("EMAIL")] - public String Email + [Column("EMAIL")] + + public String Email { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact phone number. /// </summary> - [EntityFieldName("PHONE_NUMBER")] - public String PhoneNumber + [Column("PHONE_NUMBER")] + + public String PhoneNumber { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact fax. /// </summary> - [EntityFieldName("FAX")] - public String Fax + [Column("FAX")] + + public String Fax { get { @@ -147,8 +156,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact organizations. /// </summary> - [EntityFieldName("ORGANIZATIONS")] - public ObservableCollection<Organization> Organizations + + public virtual ObservableCollection<Organization> Organizations { get { @@ -166,8 +175,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the contact users. /// </summary> - [EntityFieldName("USERS")] - public ObservableCollection<User> Users + + public virtual ObservableCollection<User> Users { get { @@ -186,24 +195,6 @@ namespace Tango.DAL.Observables /// </summary> public Contact() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Contact" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Contact(CONTACT entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Organizations = new ObservableCollection<Organization>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs index d9e57c7f3..0d464f0bf 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("DISPENSER_TYPES")] - public partial class DispenserType : ObservableEntity<DISPENSER_TYPES> + [Table("DISPENSER_TYPES")] + public partial class DispenserType : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the dispensertype code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the dispensertype name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the dispensertype nl per pulse. /// </summary> - [EntityFieldName("NL_PER_PULSE")] - public Double NlPerPulse + [Column("NL_PER_PULSE")] + + public Double NlPerPulse { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the dispensertype capacity. /// </summary> - [EntityFieldName("CAPACITY")] - public Double Capacity + [Column("CAPACITY")] + + public Double Capacity { get { @@ -90,8 +96,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the dispensertype ids packs. /// </summary> - [EntityFieldName("IDS_PACKS")] - public ObservableCollection<IdsPack> IdsPacks + + public virtual ObservableCollection<IdsPack> IdsPacks { get { @@ -110,24 +116,6 @@ namespace Tango.DAL.Observables /// </summary> public DispenserType() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="DispenserType" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public DispenserType(DISPENSER_TYPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { IdsPacks = new ObservableCollection<IdsPack>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs index d6d82faf9..da4bae985 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("EMBEDDED_FIRMWARE_VERSIONS")] - public partial class EmbeddedFirmwareVersion : ObservableEntity<EMBEDDED_FIRMWARE_VERSIONS> + [Table("EMBEDDED_FIRMWARE_VERSIONS")] + public partial class EmbeddedFirmwareVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the embeddedfirmwareversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the embeddedfirmwareversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the embeddedfirmwareversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public EmbeddedFirmwareVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="EmbeddedFirmwareVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public EmbeddedFirmwareVersion(EMBEDDED_FIRMWARE_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs index 36370f6f2..2b35dc05d 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("EMBEDDED_SOFTWARE_VERSIONS")] - public partial class EmbeddedSoftwareVersion : ObservableEntity<EMBEDDED_SOFTWARE_VERSIONS> + [Table("EMBEDDED_SOFTWARE_VERSIONS")] + public partial class EmbeddedSoftwareVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the embeddedsoftwareversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the embeddedsoftwareversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the embeddedsoftwareversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public EmbeddedSoftwareVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="EmbeddedSoftwareVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public EmbeddedSoftwareVersion(EMBEDDED_SOFTWARE_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventType.cs index b39c49ef3..77b22e35c 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventType.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("EVENT_TYPES")] - public partial class EventType : ObservableEntity<EVENT_TYPES> + [Table("EVENT_TYPES")] + public partial class EventType : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the eventtype code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the eventtype name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the eventtype description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the eventtype event types actions. /// </summary> - [EntityFieldName("EVENT_TYPES_ACTIONS")] - public ObservableCollection<EventTypesAction> EventTypesActions + + public virtual ObservableCollection<EventTypesAction> EventTypesActions { get { @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the eventtype machines events. /// </summary> - [EntityFieldName("MACHINES_EVENTS")] - public ObservableCollection<MachinesEvent> MachinesEvents + + public virtual ObservableCollection<MachinesEvent> MachinesEvents { get { @@ -110,24 +115,6 @@ namespace Tango.DAL.Observables /// </summary> public EventType() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="EventType" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public EventType(EVENT_TYPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { EventTypesActions = new ObservableCollection<EventTypesAction>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventTypesAction.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventTypesAction.cs index 5802a202d..46219549c 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventTypesAction.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EventTypesAction.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("EVENT_TYPES_ACTIONS")] - public partial class EventTypesAction : ObservableEntity<EVENT_TYPES_ACTIONS> + [Table("EVENT_TYPES_ACTIONS")] + public partial class EventTypesAction : ObservableEntity { private String _eventtypeguid; /// <summary> /// Gets or sets the eventtypesaction event type guid. /// </summary> - [EntityFieldName("EVENT_TYPE_GUID")] - public String EventTypeGuid + [Column("EVENT_TYPE_GUID")] + [ForeignKey("EventType")] + public String EventTypeGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the eventtypesaction action type guid. /// </summary> - [EntityFieldName("ACTION_TYPE_GUID")] - public String ActionTypeGuid + [Column("ACTION_TYPE_GUID")] + [ForeignKey("ActionType")] + public String ActionTypeGuid { get { @@ -48,40 +52,40 @@ namespace Tango.DAL.Observables } - private ActionType _actiontypes; + private ActionType _actiontype; /// <summary> /// Gets or sets the eventtypesaction action types. /// </summary> - [EntityFieldName("ACTION_TYPES")] - public ActionType ActionTypes + + public virtual ActionType ActionType { get { - return _actiontypes; + return _actiontype; } set { - _actiontypes = value; RaisePropertyChanged(nameof(ActionTypes)); + _actiontype = value; RaisePropertyChanged(nameof(ActionType)); } } - private EventType _eventtypes; + private EventType _eventtype; /// <summary> /// Gets or sets the eventtypesaction event types. /// </summary> - [EntityFieldName("EVENT_TYPES")] - public EventType EventTypes + + public virtual EventType EventType { get { - return _eventtypes; + return _eventtype; } set { - _eventtypes = value; RaisePropertyChanged(nameof(EventTypes)); + _eventtype = value; RaisePropertyChanged(nameof(EventType)); } } @@ -91,24 +95,6 @@ namespace Tango.DAL.Observables /// </summary> public EventTypesAction() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="EventTypesAction" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public EventTypesAction(EVENT_TYPES_ACTIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberShape.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberShape.cs index d076d0351..01abfb0a5 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberShape.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberShape.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("FIBER_SHAPES")] - public partial class FiberShape : ObservableEntity<FIBER_SHAPES> + [Table("FIBER_SHAPES")] + public partial class FiberShape : ObservableEntity { private String _name; /// <summary> /// Gets or sets the fibershape name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the fibershape code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the fibershape rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public FiberShape() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="FiberShape" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public FiberShape(FIBER_SHAPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynth.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynth.cs index df79a85da..2251bc36f 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynth.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynth.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("FIBER_SYNTHS")] - public partial class FiberSynth : ObservableEntity<FIBER_SYNTHS> + [Table("FIBER_SYNTHS")] + public partial class FiberSynth : ObservableEntity { private String _name; /// <summary> /// Gets or sets the fibersynth name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the fibersynth code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the fibersynth rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public FiberSynth() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="FiberSynth" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public FiberSynth(FIBER_SYNTHS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs index 8e5a906b0..49ad1220d 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("HARDWARE_VERSIONS")] - public partial class HardwareVersion : ObservableEntity<HARDWARE_VERSIONS> + [Table("HARDWARE_VERSIONS")] + public partial class HardwareVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the hardwareversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the hardwareversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the hardwareversion configurations. /// </summary> - [EntityFieldName("CONFIGURATIONS")] - public ObservableCollection<Configuration> Configurations + + public virtual ObservableCollection<Configuration> Configurations { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public HardwareVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="HardwareVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public HardwareVersion(HARDWARE_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Configurations = new ObservableCollection<Configuration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs index 63703ca43..dc55d3612 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("IDS_PACKS")] - public partial class IdsPack : ObservableEntity<IDS_PACKS> + [Table("IDS_PACKS")] + public partial class IdsPack : ObservableEntity { private String _configurationguid; /// <summary> /// Gets or sets the idspack configuration guid. /// </summary> - [EntityFieldName("CONFIGURATION_GUID")] - public String ConfigurationGuid + [Column("CONFIGURATION_GUID")] + [ForeignKey("Configuration")] + public String ConfigurationGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack dispenser type guid. /// </summary> - [EntityFieldName("DISPENSER_TYPE_GUID")] - public String DispenserTypeGuid + [Column("DISPENSER_TYPE_GUID")] + [ForeignKey("DispenserType")] + public String DispenserTypeGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack liquid type guid. /// </summary> - [EntityFieldName("LIQUID_TYPE_GUID")] - public String LiquidTypeGuid + [Column("LIQUID_TYPE_GUID")] + [ForeignKey("LiquidType")] + public String LiquidTypeGuid { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack cartridge type guid. /// </summary> - [EntityFieldName("CARTRIDGE_TYPE_GUID")] - public String CartridgeTypeGuid + [Column("CARTRIDGE_TYPE_GUID")] + [ForeignKey("CartridgeType")] + public String CartridgeTypeGuid { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack mid tank type guid. /// </summary> - [EntityFieldName("MID_TANK_TYPE_GUID")] - public String MidTankTypeGuid + [Column("MID_TANK_TYPE_GUID")] + [ForeignKey("MidTankType")] + public String MidTankTypeGuid { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack pack index. /// </summary> - [EntityFieldName("PACK_INDEX")] - public Int32 PackIndex + [Column("PACK_INDEX")] + + public Int32 PackIndex { get { @@ -143,21 +152,21 @@ namespace Tango.DAL.Observables } - private CartridgeType _cartridgetypes; + private CartridgeType _cartridgetype; /// <summary> /// Gets or sets the idspack cartridge types. /// </summary> - [EntityFieldName("CARTRIDGE_TYPES")] - public CartridgeType CartridgeTypes + + public virtual CartridgeType CartridgeType { get { - return _cartridgetypes; + return _cartridgetype; } set { - _cartridgetypes = value; RaisePropertyChanged(nameof(CartridgeTypes)); + _cartridgetype = value; RaisePropertyChanged(nameof(CartridgeType)); } } @@ -166,8 +175,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the idspack configuration. /// </summary> - [EntityFieldName("CONFIGURATION")] - public Configuration Configuration + + public virtual Configuration Configuration { get { @@ -181,59 +190,59 @@ namespace Tango.DAL.Observables } - private DispenserType _dispensertypes; + private DispenserType _dispensertype; /// <summary> /// Gets or sets the idspack dispenser types. /// </summary> - [EntityFieldName("DISPENSER_TYPES")] - public DispenserType DispenserTypes + + public virtual DispenserType DispenserType { get { - return _dispensertypes; + return _dispensertype; } set { - _dispensertypes = value; RaisePropertyChanged(nameof(DispenserTypes)); + _dispensertype = value; RaisePropertyChanged(nameof(DispenserType)); } } - private LiquidType _liquidtypes; + private LiquidType _liquidtype; /// <summary> /// Gets or sets the idspack liquid types. /// </summary> - [EntityFieldName("LIQUID_TYPES")] - public LiquidType LiquidTypes + + public virtual LiquidType LiquidType { get { - return _liquidtypes; + return _liquidtype; } set { - _liquidtypes = value; RaisePropertyChanged(nameof(LiquidTypes)); + _liquidtype = value; RaisePropertyChanged(nameof(LiquidType)); } } - private MidTankType _midtanktypes; + private MidTankType _midtanktype; /// <summary> /// Gets or sets the idspack mid tank types. /// </summary> - [EntityFieldName("MID_TANK_TYPES")] - public MidTankType MidTankTypes + + public virtual MidTankType MidTankType { get { - return _midtanktypes; + return _midtanktype; } set { - _midtanktypes = value; RaisePropertyChanged(nameof(MidTankTypes)); + _midtanktype = value; RaisePropertyChanged(nameof(MidTankType)); } } @@ -243,24 +252,6 @@ namespace Tango.DAL.Observables /// </summary> public IdsPack() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="IdsPack" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public IdsPack(IDS_PACKS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Job.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Job.cs index cfbc66d9b..fb3c20032 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Job.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("JOBS")] - public partial class Job : ObservableEntity<JOB> + [Table("JOBS")] + public partial class Job : ObservableEntity { private DateTime _creationdate; /// <summary> /// Gets or sets the job creation date. /// </summary> - [EntityFieldName("CREATION_DATE")] - public DateTime CreationDate + [Column("CREATION_DATE")] + + public DateTime CreationDate { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job machine guid. /// </summary> - [EntityFieldName("MACHINE_GUID")] - public String MachineGuid + [Column("MACHINE_GUID")] + [ForeignKey("Machine")] + public String MachineGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job rml guid. /// </summary> - [EntityFieldName("RML_GUID")] - public String RmlGuid + [Column("RML_GUID")] + [ForeignKey("Rml")] + public String RmlGuid { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job winding method guid. /// </summary> - [EntityFieldName("WINDING_METHOD_GUID")] - public String WindingMethodGuid + [Column("WINDING_METHOD_GUID")] + [ForeignKey("WindingMethod")] + public String WindingMethodGuid { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job inter segment length. /// </summary> - [EntityFieldName("INTER_SEGMENT_LENGTH")] - public Double InterSegmentLength + [Column("INTER_SEGMENT_LENGTH")] + + public Double InterSegmentLength { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job enable inter segment. /// </summary> - [EntityFieldName("ENABLE_INTER_SEGMENT")] - public Boolean EnableInterSegment + [Column("ENABLE_INTER_SEGMENT")] + + public Boolean EnableInterSegment { get { @@ -166,8 +176,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job enable lubrication. /// </summary> - [EntityFieldName("ENABLE_LUBRICATION")] - public Boolean EnableLubrication + [Column("ENABLE_LUBRICATION")] + + public Boolean EnableLubrication { get { @@ -185,8 +196,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job job runs. /// </summary> - [EntityFieldName("JOB_RUNS")] - public ObservableCollection<JobRun> JobRuns + + public virtual ObservableCollection<JobRun> JobRuns { get { @@ -204,8 +215,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job machine. /// </summary> - [EntityFieldName("MACHINE")] - public Machine Machine + + public virtual Machine Machine { get { @@ -223,8 +234,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job rml. /// </summary> - [EntityFieldName("RML")] - public Rml Rml + + public virtual Rml Rml { get { @@ -238,21 +249,21 @@ namespace Tango.DAL.Observables } - private WindingMethod _windingmethods; + private WindingMethod _windingmethod; /// <summary> /// Gets or sets the job winding methods. /// </summary> - [EntityFieldName("WINDING_METHODS")] - public WindingMethod WindingMethods + + public virtual WindingMethod WindingMethod { get { - return _windingmethods; + return _windingmethod; } set { - _windingmethods = value; RaisePropertyChanged(nameof(WindingMethods)); + _windingmethod = value; RaisePropertyChanged(nameof(WindingMethod)); } } @@ -261,8 +272,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the job segments. /// </summary> - [EntityFieldName("SEGMENTS")] - public ObservableCollection<Segment> Segments + + public virtual ObservableCollection<Segment> Segments { get { @@ -281,24 +292,6 @@ namespace Tango.DAL.Observables /// </summary> public Job() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Job" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Job(JOB entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { JobRuns = new ObservableCollection<JobRun>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/JobRun.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/JobRun.cs index ca8f56b94..3d8c1cb48 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/JobRun.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/JobRun.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("JOB_RUNS")] - public partial class JobRun : ObservableEntity<JOB_RUNS> + [Table("JOB_RUNS")] + public partial class JobRun : ObservableEntity { private String _jobguid; /// <summary> /// Gets or sets the jobrun job guid. /// </summary> - [EntityFieldName("JOB_GUID")] - public String JobGuid + [Column("JOB_GUID")] + [ForeignKey("Job")] + public String JobGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the jobrun start date. /// </summary> - [EntityFieldName("START_DATE")] - public DateTime StartDate + [Column("START_DATE")] + + public DateTime StartDate { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the jobrun end date. /// </summary> - [EntityFieldName("END_DATE")] - public DateTime EndDate + [Column("END_DATE")] + + public DateTime EndDate { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the jobrun successful. /// </summary> - [EntityFieldName("SUCCESSFUL")] - public Boolean Successful + [Column("SUCCESSFUL")] + + public Boolean Successful { get { @@ -90,8 +96,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the jobrun job. /// </summary> - [EntityFieldName("JOB")] - public Job Job + + public virtual Job Job { get { @@ -110,24 +116,6 @@ namespace Tango.DAL.Observables /// </summary> public JobRun() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="JobRun" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public JobRun(JOB_RUNS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/LinearMassDensityUnit.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/LinearMassDensityUnit.cs index 81e68141f..5767c5533 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/LinearMassDensityUnit.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/LinearMassDensityUnit.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("LINEAR_MASS_DENSITY_UNITS")] - public partial class LinearMassDensityUnit : ObservableEntity<LINEAR_MASS_DENSITY_UNITS> + [Table("LINEAR_MASS_DENSITY_UNITS")] + public partial class LinearMassDensityUnit : ObservableEntity { private String _name; /// <summary> /// Gets or sets the linearmassdensityunit name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the linearmassdensityunit code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the linearmassdensityunit rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public LinearMassDensityUnit() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="LinearMassDensityUnit" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public LinearMassDensityUnit(LINEAR_MASS_DENSITY_UNITS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidType.cs index fb493f1d5..b59a1d0c6 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidType.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("LIQUID_TYPES")] - public partial class LiquidType : ObservableEntity<LIQUID_TYPES> + [Table("LIQUID_TYPES")] + public partial class LiquidType : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the liquidtype code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtype name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtype version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtype color. /// </summary> - [EntityFieldName("COLOR")] - public Int32 Color + [Column("COLOR")] + + public Int32 Color { get { @@ -90,8 +96,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtype cats. /// </summary> - [EntityFieldName("CATS")] - public ObservableCollection<Cat> Cats + + public virtual ObservableCollection<Cat> Cats { get { @@ -109,8 +115,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtype ids packs. /// </summary> - [EntityFieldName("IDS_PACKS")] - public ObservableCollection<IdsPack> IdsPacks + + public virtual ObservableCollection<IdsPack> IdsPacks { get { @@ -128,8 +134,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtype liquid types rmls. /// </summary> - [EntityFieldName("LIQUID_TYPES_RMLS")] - public ObservableCollection<LiquidTypesRml> LiquidTypesRmls + + public virtual ObservableCollection<LiquidTypesRml> LiquidTypesRmls { get { @@ -148,24 +154,6 @@ namespace Tango.DAL.Observables /// </summary> public LiquidType() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="LiquidType" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public LiquidType(LIQUID_TYPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Cats = new ObservableCollection<Cat>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidTypesRml.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidTypesRml.cs index f2116bb65..4a4136bf9 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidTypesRml.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/LiquidTypesRml.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("LIQUID_TYPES_RMLS")] - public partial class LiquidTypesRml : ObservableEntity<LIQUID_TYPES_RMLS> + [Table("LIQUID_TYPES_RMLS")] + public partial class LiquidTypesRml : ObservableEntity { private String _liquidtypeguid; /// <summary> /// Gets or sets the liquidtypesrml liquid type guid. /// </summary> - [EntityFieldName("LIQUID_TYPE_GUID")] - public String LiquidTypeGuid + [Column("LIQUID_TYPE_GUID")] + [ForeignKey("LiquidType")] + public String LiquidTypeGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtypesrml rml guid. /// </summary> - [EntityFieldName("RML_GUID")] - public String RmlGuid + [Column("RML_GUID")] + [ForeignKey("Rml")] + public String RmlGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtypesrml max nl per cm. /// </summary> - [EntityFieldName("MAX_NL_PER_CM")] - public Double MaxNlPerCm + [Column("MAX_NL_PER_CM")] + + public Double MaxNlPerCm { get { @@ -67,21 +72,21 @@ namespace Tango.DAL.Observables } - private LiquidType _liquidtypes; + private LiquidType _liquidtype; /// <summary> /// Gets or sets the liquidtypesrml liquid types. /// </summary> - [EntityFieldName("LIQUID_TYPES")] - public LiquidType LiquidTypes + + public virtual LiquidType LiquidType { get { - return _liquidtypes; + return _liquidtype; } set { - _liquidtypes = value; RaisePropertyChanged(nameof(LiquidTypes)); + _liquidtype = value; RaisePropertyChanged(nameof(LiquidType)); } } @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the liquidtypesrml rml. /// </summary> - [EntityFieldName("RML")] - public Rml Rml + + public virtual Rml Rml { get { @@ -110,24 +115,6 @@ namespace Tango.DAL.Observables /// </summary> public LiquidTypesRml() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="LiquidTypesRml" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public LiquidTypesRml(LIQUID_TYPES_RMLS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs index 89ced9f0a..7328f411c 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MACHINES")] - public partial class Machine : ObservableEntity<MACHINE> + [Table("MACHINES")] + public partial class Machine : ObservableEntity { private String _serialnumber; /// <summary> /// Gets or sets the machine serial number. /// </summary> - [EntityFieldName("SERIAL_NUMBER")] - public String SerialNumber + [Column("SERIAL_NUMBER")] + + public String SerialNumber { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine production date. /// </summary> - [EntityFieldName("PRODUCTION_DATE")] - public DateTime ProductionDate + [Column("PRODUCTION_DATE")] + + public DateTime ProductionDate { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine organization guid. /// </summary> - [EntityFieldName("ORGANIZATION_GUID")] - public String OrganizationGuid + [Column("ORGANIZATION_GUID")] + [ForeignKey("Organization")] + public String OrganizationGuid { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine machine version guid. /// </summary> - [EntityFieldName("MACHINE_VERSION_GUID")] - public String MachineVersionGuid + [Column("MACHINE_VERSION_GUID")] + [ForeignKey("MachineVersion")] + public String MachineVersionGuid { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine configuration guid. /// </summary> - [EntityFieldName("CONFIGURATION_GUID")] - public String ConfigurationGuid + [Column("CONFIGURATION_GUID")] + [ForeignKey("Configuration")] + public String ConfigurationGuid { get { @@ -128,8 +136,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine configuration. /// </summary> - [EntityFieldName("CONFIGURATION")] - public Configuration Configuration + + public virtual Configuration Configuration { get { @@ -147,8 +155,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine jobs. /// </summary> - [EntityFieldName("JOBS")] - public ObservableCollection<Job> Jobs + + public virtual ObservableCollection<Job> Jobs { get { @@ -162,21 +170,21 @@ namespace Tango.DAL.Observables } - private MachineVersion _machineversions; + private MachineVersion _machineversion; /// <summary> /// Gets or sets the machine machine versions. /// </summary> - [EntityFieldName("MACHINE_VERSIONS")] - public MachineVersion MachineVersions + + public virtual MachineVersion MachineVersion { get { - return _machineversions; + return _machineversion; } set { - _machineversions = value; RaisePropertyChanged(nameof(MachineVersions)); + _machineversion = value; RaisePropertyChanged(nameof(MachineVersion)); } } @@ -185,8 +193,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine machines configurations. /// </summary> - [EntityFieldName("MACHINES_CONFIGURATIONS")] - public ObservableCollection<MachinesConfiguration> MachinesConfigurations + + public virtual ObservableCollection<MachinesConfiguration> MachinesConfigurations { get { @@ -204,8 +212,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine machines events. /// </summary> - [EntityFieldName("MACHINES_EVENTS")] - public ObservableCollection<MachinesEvent> MachinesEvents + + public virtual ObservableCollection<MachinesEvent> MachinesEvents { get { @@ -223,8 +231,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machine organization. /// </summary> - [EntityFieldName("ORGANIZATION")] - public Organization Organization + + public virtual Organization Organization { get { @@ -243,24 +251,6 @@ namespace Tango.DAL.Observables /// </summary> public Machine() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Machine" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Machine(MACHINE entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Jobs = new ObservableCollection<Job>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs index ab640ec41..95dc7d261 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MACHINE_VERSIONS")] - public partial class MachineVersion : ObservableEntity<MACHINE_VERSIONS> + [Table("MACHINE_VERSIONS")] + public partial class MachineVersion : ObservableEntity { private Double _version; /// <summary> /// Gets or sets the machineversion version. /// </summary> - [EntityFieldName("VERSION")] - public Double Version + [Column("VERSION")] + + public Double Version { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machineversion name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machineversion default configuration guid. /// </summary> - [EntityFieldName("DEFAULT_CONFIGURATION_GUID")] - public String DefaultConfigurationGuid + [Column("DEFAULT_CONFIGURATION_GUID")] + [ForeignKey("DefaultConfiguration")] + public String DefaultConfigurationGuid { get { @@ -67,21 +72,21 @@ namespace Tango.DAL.Observables } - private Configuration _configuration; + private Configuration _defaultconfiguration; /// <summary> /// Gets or sets the machineversion configuration. /// </summary> - [EntityFieldName("CONFIGURATION")] - public Configuration Configuration + + public virtual Configuration DefaultConfiguration { get { - return _configuration; + return _defaultconfiguration; } set { - _configuration = value; RaisePropertyChanged(nameof(Configuration)); + _defaultconfiguration = value; RaisePropertyChanged(nameof(DefaultConfiguration)); } } @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machineversion machines. /// </summary> - [EntityFieldName("MACHINES")] - public ObservableCollection<Machine> Machines + + public virtual ObservableCollection<Machine> Machines { get { @@ -110,24 +115,6 @@ namespace Tango.DAL.Observables /// </summary> public MachineVersion() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MachineVersion" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MachineVersion(MACHINE_VERSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Machines = new ObservableCollection<Machine>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesConfiguration.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesConfiguration.cs index 209c1ef76..9958a0fcd 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesConfiguration.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesConfiguration.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MACHINES_CONFIGURATIONS")] - public partial class MachinesConfiguration : ObservableEntity<MACHINES_CONFIGURATIONS> + [Table("MACHINES_CONFIGURATIONS")] + public partial class MachinesConfiguration : ObservableEntity { private String _machineguid; /// <summary> /// Gets or sets the machinesconfiguration machine guid. /// </summary> - [EntityFieldName("MACHINE_GUID")] - public String MachineGuid + [Column("MACHINE_GUID")] + [ForeignKey("Machine")] + public String MachineGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesconfiguration configuration guid. /// </summary> - [EntityFieldName("CONFIGURATION_GUID")] - public String ConfigurationGuid + [Column("CONFIGURATION_GUID")] + [ForeignKey("Configuration")] + public String ConfigurationGuid { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesconfiguration configuration. /// </summary> - [EntityFieldName("CONFIGURATION")] - public Configuration Configuration + + public virtual Configuration Configuration { get { @@ -71,8 +75,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesconfiguration machine. /// </summary> - [EntityFieldName("MACHINE")] - public Machine Machine + + public virtual Machine Machine { get { @@ -91,24 +95,6 @@ namespace Tango.DAL.Observables /// </summary> public MachinesConfiguration() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MachinesConfiguration" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MachinesConfiguration(MACHINES_CONFIGURATIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesEvent.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesEvent.cs index db33fb57d..659c0c0ed 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesEvent.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachinesEvent.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MACHINES_EVENTS")] - public partial class MachinesEvent : ObservableEntity<MACHINES_EVENTS> + [Table("MACHINES_EVENTS")] + public partial class MachinesEvent : ObservableEntity { private String _machineguid; /// <summary> /// Gets or sets the machinesevent machine guid. /// </summary> - [EntityFieldName("MACHINE_GUID")] - public String MachineGuid + [Column("MACHINE_GUID")] + [ForeignKey("Machine")] + public String MachineGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesevent event type guid. /// </summary> - [EntityFieldName("EVENT_TYPE_GUID")] - public String EventTypeGuid + [Column("EVENT_TYPE_GUID")] + [ForeignKey("EventType")] + public String EventTypeGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesevent user guid. /// </summary> - [EntityFieldName("USER_GUID")] - public String UserGuid + [Column("USER_GUID")] + [ForeignKey("User")] + public String UserGuid { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesevent date time. /// </summary> - [EntityFieldName("DATE_TIME")] - public DateTime DateTime + [Column("DATE_TIME")] + + public DateTime DateTime { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesevent description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -105,21 +112,21 @@ namespace Tango.DAL.Observables } - private EventType _eventtypes; + private EventType _eventtype; /// <summary> /// Gets or sets the machinesevent event types. /// </summary> - [EntityFieldName("EVENT_TYPES")] - public EventType EventTypes + + public virtual EventType EventType { get { - return _eventtypes; + return _eventtype; } set { - _eventtypes = value; RaisePropertyChanged(nameof(EventTypes)); + _eventtype = value; RaisePropertyChanged(nameof(EventType)); } } @@ -128,8 +135,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesevent machine. /// </summary> - [EntityFieldName("MACHINE")] - public Machine Machine + + public virtual Machine Machine { get { @@ -147,8 +154,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the machinesevent user. /// </summary> - [EntityFieldName("USER")] - public User User + + public virtual User User { get { @@ -167,24 +174,6 @@ namespace Tango.DAL.Observables /// </summary> public MachinesEvent() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MachinesEvent" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MachinesEvent(MACHINES_EVENTS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaColor.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaColor.cs index 943ec1e92..bd9b55b10 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaColor.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaColor.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MEDIA_COLORS")] - public partial class MediaColor : ObservableEntity<MEDIA_COLORS> + [Table("MEDIA_COLORS")] + public partial class MediaColor : ObservableEntity { private Int32 _color; /// <summary> /// Gets or sets the mediacolor color. /// </summary> - [EntityFieldName("COLOR")] - public Int32 Color + [Column("COLOR")] + + public Int32 Color { get { @@ -33,8 +36,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediacolor rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -53,24 +56,6 @@ namespace Tango.DAL.Observables /// </summary> public MediaColor() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MediaColor" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MediaColor(MEDIA_COLORS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaCondition.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaCondition.cs index 9f299e746..1ad80393f 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaCondition.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaCondition.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MEDIA_CONDITIONS")] - public partial class MediaCondition : ObservableEntity<MEDIA_CONDITIONS> + [Table("MEDIA_CONDITIONS")] + public partial class MediaCondition : ObservableEntity { private String _name; /// <summary> /// Gets or sets the mediacondition name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediacondition code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediacondition rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public MediaCondition() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MediaCondition" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MediaCondition(MEDIA_CONDITIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaMaterial.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaMaterial.cs index 04719d87b..c27a7a91b 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaMaterial.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaMaterial.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MEDIA_MATERIALS")] - public partial class MediaMaterial : ObservableEntity<MEDIA_MATERIALS> + [Table("MEDIA_MATERIALS")] + public partial class MediaMaterial : ObservableEntity { private String _name; /// <summary> /// Gets or sets the mediamaterial name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediamaterial code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediamaterial rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public MediaMaterial() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MediaMaterial" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MediaMaterial(MEDIA_MATERIALS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaPurpos.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaPurpos.cs index 50897bfb3..d40a87ae9 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaPurpos.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MediaPurpos.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MEDIA_PURPOSES")] - public partial class MediaPurpos : ObservableEntity<MEDIA_PURPOSES> + [Table("MEDIA_PURPOSES")] + public partial class MediaPurpos : ObservableEntity { private String _name; /// <summary> /// Gets or sets the mediapurpos name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediapurpos code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the mediapurpos rmls. /// </summary> - [EntityFieldName("RMLS")] - public ObservableCollection<Rml> Rmls + + public virtual ObservableCollection<Rml> Rmls { get { @@ -72,24 +76,6 @@ namespace Tango.DAL.Observables /// </summary> public MediaPurpos() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MediaPurpos" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MediaPurpos(MEDIA_PURPOSES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Rmls = new ObservableCollection<Rml>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MidTankType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MidTankType.cs index afb01dae9..591f8c3ff 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MidTankType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MidTankType.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("MID_TANK_TYPES")] - public partial class MidTankType : ObservableEntity<MID_TANK_TYPES> + [Table("MID_TANK_TYPES")] + public partial class MidTankType : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the midtanktype code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the midtanktype name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the midtanktype liter capacity. /// </summary> - [EntityFieldName("LITER_CAPACITY")] - public Double LiterCapacity + [Column("LITER_CAPACITY")] + + public Double LiterCapacity { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the midtanktype ids packs. /// </summary> - [EntityFieldName("IDS_PACKS")] - public ObservableCollection<IdsPack> IdsPacks + + public virtual ObservableCollection<IdsPack> IdsPacks { get { @@ -91,24 +96,6 @@ namespace Tango.DAL.Observables /// </summary> public MidTankType() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MidTankType" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MidTankType(MID_TANK_TYPES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { IdsPacks = new ObservableCollection<IdsPack>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Organization.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Organization.cs index 8977c6ab8..44e4edc4f 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Organization.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Organization.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("ORGANIZATIONS")] - public partial class Organization : ObservableEntity<ORGANIZATION> + [Table("ORGANIZATIONS")] + public partial class Organization : ObservableEntity { private String _name; /// <summary> /// Gets or sets the organization name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the organization contact guid. /// </summary> - [EntityFieldName("CONTACT_GUID")] - public String ContactGuid + [Column("CONTACT_GUID")] + [ForeignKey("Contact")] + public String ContactGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the organization address guid. /// </summary> - [EntityFieldName("ADDRESS_GUID")] - public String AddressGuid + [Column("ADDRESS_GUID")] + [ForeignKey("Address")] + public String AddressGuid { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the organization address. /// </summary> - [EntityFieldName("ADDRESS")] - public Address Address + + public virtual Address Address { get { @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the organization contact. /// </summary> - [EntityFieldName("CONTACT")] - public Contact Contact + + public virtual Contact Contact { get { @@ -109,8 +114,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the organization machines. /// </summary> - [EntityFieldName("MACHINES")] - public ObservableCollection<Machine> Machines + + public virtual ObservableCollection<Machine> Machines { get { @@ -128,8 +133,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the organization users. /// </summary> - [EntityFieldName("USERS")] - public ObservableCollection<User> Users + + public virtual ObservableCollection<User> Users { get { @@ -148,24 +153,6 @@ namespace Tango.DAL.Observables /// </summary> public Organization() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Organization" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Organization(ORGANIZATION entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Machines = new ObservableCollection<Machine>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Permission.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Permission.cs index 6476442ba..1a3fcd108 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Permission.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Permission.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("PERMISSIONS")] - public partial class Permission : ObservableEntity<PERMISSION> + [Table("PERMISSIONS")] + public partial class Permission : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the permission code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the permission name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the permission description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the permission roles permissions. /// </summary> - [EntityFieldName("ROLES_PERMISSIONS")] - public ObservableCollection<RolesPermission> RolesPermissions + + public virtual ObservableCollection<RolesPermission> RolesPermissions { get { @@ -91,24 +96,6 @@ namespace Tango.DAL.Observables /// </summary> public Permission() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Permission" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Permission(PERMISSION entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { RolesPermissions = new ObservableCollection<RolesPermission>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTable.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTable.cs index 4ecb489c6..167c2ebef 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTable.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTable.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("PROCESS_PARAMETERS_TABLES")] - public partial class ProcessParametersTable : ObservableEntity<PROCESS_PARAMETERS_TABLES> + [Table("PROCESS_PARAMETERS_TABLES")] + public partial class ProcessParametersTable : ObservableEntity { private String _name; /// <summary> /// Gets or sets the processparameterstable name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable dyeing speed. /// </summary> - [EntityFieldName("DYEING_SPEED")] - public Double DyeingSpeed + [Column("DYEING_SPEED")] + + public Double DyeingSpeed { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable min ink uptake. /// </summary> - [EntityFieldName("MIN_INK_UPTAKE")] - public Double MinInkUptake + [Column("MIN_INK_UPTAKE")] + + public Double MinInkUptake { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable mixer temp. /// </summary> - [EntityFieldName("MIXER_TEMP")] - public Double MixerTemp + [Column("MIXER_TEMP")] + + public Double MixerTemp { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable head zone1 temp. /// </summary> - [EntityFieldName("HEAD_ZONE1_TEMP")] - public Double HeadZone1Temp + [Column("HEAD_ZONE1_TEMP")] + + public Double HeadZone1Temp { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable head zone2 temp. /// </summary> - [EntityFieldName("HEAD_ZONE2_TEMP")] - public Double HeadZone2Temp + [Column("HEAD_ZONE2_TEMP")] + + public Double HeadZone2Temp { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable head zone3 temp. /// </summary> - [EntityFieldName("HEAD_ZONE3_TEMP")] - public Double HeadZone3Temp + [Column("HEAD_ZONE3_TEMP")] + + public Double HeadZone3Temp { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable head air flow. /// </summary> - [EntityFieldName("HEAD_AIR_FLOW")] - public Double HeadAirFlow + [Column("HEAD_AIR_FLOW")] + + public Double HeadAirFlow { get { @@ -166,8 +176,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable feeder tension. /// </summary> - [EntityFieldName("FEEDER_TENSION")] - public Double FeederTension + [Column("FEEDER_TENSION")] + + public Double FeederTension { get { @@ -185,8 +196,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable puller tension. /// </summary> - [EntityFieldName("PULLER_TENSION")] - public Double PullerTension + [Column("PULLER_TENSION")] + + public Double PullerTension { get { @@ -204,8 +216,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable dryer buffer length. /// </summary> - [EntityFieldName("DRYER_BUFFER_LENGTH")] - public Double DryerBufferLength + [Column("DRYER_BUFFER_LENGTH")] + + public Double DryerBufferLength { get { @@ -223,8 +236,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable dryer zone1 temp. /// </summary> - [EntityFieldName("DRYER_ZONE1_TEMP")] - public Double DryerZone1Temp + [Column("DRYER_ZONE1_TEMP")] + + public Double DryerZone1Temp { get { @@ -242,8 +256,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable dryer zone2 temp. /// </summary> - [EntityFieldName("DRYER_ZONE2_TEMP")] - public Double DryerZone2Temp + [Column("DRYER_ZONE2_TEMP")] + + public Double DryerZone2Temp { get { @@ -261,8 +276,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable dryer zone3 temp. /// </summary> - [EntityFieldName("DRYER_ZONE3_TEMP")] - public Double DryerZone3Temp + [Column("DRYER_ZONE3_TEMP")] + + public Double DryerZone3Temp { get { @@ -280,8 +296,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable dryer air flow. /// </summary> - [EntityFieldName("DRYER_AIR_FLOW")] - public Double DryerAirFlow + [Column("DRYER_AIR_FLOW")] + + public Double DryerAirFlow { get { @@ -299,8 +316,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable winder tension. /// </summary> - [EntityFieldName("WINDER_TENSION")] - public Double WinderTension + [Column("WINDER_TENSION")] + + public Double WinderTension { get { @@ -318,8 +336,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable process parameters tables group guid. /// </summary> - [EntityFieldName("PROCESS_PARAMETERS_TABLES_GROUP_GUID")] - public String ProcessParametersTablesGroupGuid + [Column("PROCESS_PARAMETERS_TABLES_GROUP_GUID")] + [ForeignKey("ProcessParametersTablesGroup")] + public String ProcessParametersTablesGroupGuid { get { @@ -337,8 +356,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstable table index. /// </summary> - [EntityFieldName("TABLE_INDEX")] - public Int32 TableIndex + [Column("TABLE_INDEX")] + + public Int32 TableIndex { get { @@ -352,21 +372,21 @@ namespace Tango.DAL.Observables } - private ProcessParametersTablesGroup _processparameterstablesgroups; + private ProcessParametersTablesGroup _processparameterstablesgroup; /// <summary> /// Gets or sets the processparameterstable process parameters tables groups. /// </summary> - [EntityFieldName("PROCESS_PARAMETERS_TABLES_GROUPS")] - public ProcessParametersTablesGroup ProcessParametersTablesGroups + + public virtual ProcessParametersTablesGroup ProcessParametersTablesGroup { get { - return _processparameterstablesgroups; + return _processparameterstablesgroup; } set { - _processparameterstablesgroups = value; RaisePropertyChanged(nameof(ProcessParametersTablesGroups)); + _processparameterstablesgroup = value; RaisePropertyChanged(nameof(ProcessParametersTablesGroup)); } } @@ -376,24 +396,6 @@ namespace Tango.DAL.Observables /// </summary> public ProcessParametersTable() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ProcessParametersTable" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ProcessParametersTable(PROCESS_PARAMETERS_TABLES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTablesGroup.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTablesGroup.cs index 8582f556a..55f5dba33 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTablesGroup.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ProcessParametersTablesGroup.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("PROCESS_PARAMETERS_TABLES_GROUPS")] - public partial class ProcessParametersTablesGroup : ObservableEntity<PROCESS_PARAMETERS_TABLES_GROUPS> + [Table("PROCESS_PARAMETERS_TABLES_GROUPS")] + public partial class ProcessParametersTablesGroup : ObservableEntity { private String _rmlguid; /// <summary> /// Gets or sets the processparameterstablesgroup rml guid. /// </summary> - [EntityFieldName("RML_GUID")] - public String RmlGuid + [Column("RML_GUID")] + [ForeignKey("Rml")] + public String RmlGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstablesgroup name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstablesgroup active. /// </summary> - [EntityFieldName("ACTIVE")] - public Boolean Active + [Column("ACTIVE")] + + public Boolean Active { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstablesgroup save date. /// </summary> - [EntityFieldName("SAVE_DATE")] - public DateTime SaveDate + [Column("SAVE_DATE")] + + public DateTime SaveDate { get { @@ -90,8 +96,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstablesgroup process parameters tables. /// </summary> - [EntityFieldName("PROCESS_PARAMETERS_TABLES")] - public ObservableCollection<ProcessParametersTable> ProcessParametersTables + + public virtual ObservableCollection<ProcessParametersTable> ProcessParametersTables { get { @@ -109,8 +115,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the processparameterstablesgroup rml. /// </summary> - [EntityFieldName("RML")] - public Rml Rml + + public virtual Rml Rml { get { @@ -129,24 +135,6 @@ namespace Tango.DAL.Observables /// </summary> public ProcessParametersTablesGroup() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="ProcessParametersTablesGroup" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ProcessParametersTablesGroup(PROCESS_PARAMETERS_TABLES_GROUPS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { ProcessParametersTables = new ObservableCollection<ProcessParametersTable>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs index f293edb30..18e04f9b9 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("RMLS")] - public partial class Rml : ObservableEntity<RML> + [Table("RMLS")] + public partial class Rml : ObservableEntity { private String _name; /// <summary> /// Gets or sets the rml name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml manufacturer. /// </summary> - [EntityFieldName("MANUFACTURER")] - public String Manufacturer + [Column("MANUFACTURER")] + + public String Manufacturer { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -67,78 +72,82 @@ namespace Tango.DAL.Observables } - private String _materialguid; + private String _mediamaterialguid; /// <summary> - /// Gets or sets the rml material guid. + /// Gets or sets the rml media material guid. /// </summary> - [EntityFieldName("MATERIAL_GUID")] - public String MaterialGuid + [Column("MEDIA_MATERIAL_GUID")] + [ForeignKey("MediaMaterial")] + public String MediaMaterialGuid { get { - return _materialguid; + return _mediamaterialguid; } set { - _materialguid = value; RaisePropertyChanged(nameof(MaterialGuid)); + _mediamaterialguid = value; RaisePropertyChanged(nameof(MediaMaterialGuid)); } } - private String _colorguid; + private String _mediacolorguid; /// <summary> - /// Gets or sets the rml color guid. + /// Gets or sets the rml media color guid. /// </summary> - [EntityFieldName("COLOR_GUID")] - public String ColorGuid + [Column("MEDIA_COLOR_GUID")] + [ForeignKey("MediaColor")] + public String MediaColorGuid { get { - return _colorguid; + return _mediacolorguid; } set { - _colorguid = value; RaisePropertyChanged(nameof(ColorGuid)); + _mediacolorguid = value; RaisePropertyChanged(nameof(MediaColorGuid)); } } - private String _purposeguid; + private String _mediapurposeguid; /// <summary> - /// Gets or sets the rml purpose guid. + /// Gets or sets the rml media purpose guid. /// </summary> - [EntityFieldName("PURPOSE_GUID")] - public String PurposeGuid + [Column("MEDIA_PURPOSE_GUID")] + [ForeignKey("MediaPurpose")] + public String MediaPurposeGuid { get { - return _purposeguid; + return _mediapurposeguid; } set { - _purposeguid = value; RaisePropertyChanged(nameof(PurposeGuid)); + _mediapurposeguid = value; RaisePropertyChanged(nameof(MediaPurposeGuid)); } } - private String _conditionguid; + private String _mediaconditionguid; /// <summary> - /// Gets or sets the rml condition guid. + /// Gets or sets the rml media condition guid. /// </summary> - [EntityFieldName("CONDITION_GUID")] - public String ConditionGuid + [Column("MEDIA_CONDITION_GUID")] + [ForeignKey("MediaCondition")] + public String MediaConditionGuid { get { - return _conditionguid; + return _mediaconditionguid; } set { - _conditionguid = value; RaisePropertyChanged(nameof(ConditionGuid)); + _mediaconditionguid = value; RaisePropertyChanged(nameof(MediaConditionGuid)); } } @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml linear mass density unit guid. /// </summary> - [EntityFieldName("LINEAR_MASS_DENSITY_UNIT_GUID")] - public String LinearMassDensityUnitGuid + [Column("LINEAR_MASS_DENSITY_UNIT_GUID")] + [ForeignKey("LinearMassDensityUnit")] + public String LinearMassDensityUnitGuid { get { @@ -166,8 +176,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml fiber shape guid. /// </summary> - [EntityFieldName("FIBER_SHAPE_GUID")] - public String FiberShapeGuid + [Column("FIBER_SHAPE_GUID")] + [ForeignKey("FiberShape")] + public String FiberShapeGuid { get { @@ -185,8 +196,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml fiber synth guid. /// </summary> - [EntityFieldName("FIBER_SYNTH_GUID")] - public String FiberSynthGuid + [Column("FIBER_SYNTH_GUID")] + [ForeignKey("FiberSynth")] + public String FiberSynthGuid { get { @@ -204,8 +216,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml fiber size. /// </summary> - [EntityFieldName("FIBER_SIZE")] - public Double FiberSize + [Column("FIBER_SIZE")] + + public Double FiberSize { get { @@ -223,8 +236,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml number of fibers. /// </summary> - [EntityFieldName("NUMBER_OF_FIBERS")] - public Int32 NumberOfFibers + [Column("NUMBER_OF_FIBERS")] + + public Int32 NumberOfFibers { get { @@ -242,8 +256,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml plies per fiber. /// </summary> - [EntityFieldName("PLIES_PER_FIBER")] - public Int32 PliesPerFiber + [Column("PLIES_PER_FIBER")] + + public Int32 PliesPerFiber { get { @@ -261,8 +276,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml plies per thread. /// </summary> - [EntityFieldName("PLIES_PER_THREAD")] - public Int32 PliesPerThread + [Column("PLIES_PER_THREAD")] + + public Int32 PliesPerThread { get { @@ -280,8 +296,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml twisted. /// </summary> - [EntityFieldName("TWISTED")] - public Boolean Twisted + [Column("TWISTED")] + + public Boolean Twisted { get { @@ -299,8 +316,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml air entanglement. /// </summary> - [EntityFieldName("AIR_ENTANGLEMENT")] - public Boolean AirEntanglement + [Column("AIR_ENTANGLEMENT")] + + public Boolean AirEntanglement { get { @@ -318,8 +336,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml lubricant. /// </summary> - [EntityFieldName("LUBRICANT")] - public Boolean Lubricant + [Column("LUBRICANT")] + + public Boolean Lubricant { get { @@ -337,8 +356,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml tensile strength. /// </summary> - [EntityFieldName("TENSILE_STRENGTH")] - public Double TensileStrength + [Column("TENSILE_STRENGTH")] + + public Double TensileStrength { get { @@ -356,8 +376,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml elongation at break percentage. /// </summary> - [EntityFieldName("ELONGATION_AT_BREAK_PERCENTAGE")] - public Double ElongationAtBreakPercentage + [Column("ELONGATION_AT_BREAK_PERCENTAGE")] + + public Double ElongationAtBreakPercentage { get { @@ -375,8 +396,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml estimated thread diameter. /// </summary> - [EntityFieldName("ESTIMATED_THREAD_DIAMETER")] - public Double EstimatedThreadDiameter + [Column("ESTIMATED_THREAD_DIAMETER")] + + public Double EstimatedThreadDiameter { get { @@ -394,8 +416,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml cats. /// </summary> - [EntityFieldName("CATS")] - public ObservableCollection<Cat> Cats + + public virtual ObservableCollection<Cat> Cats { get { @@ -413,8 +435,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml ccts. /// </summary> - [EntityFieldName("CCTS")] - public ObservableCollection<Cct> Ccts + + public virtual ObservableCollection<Cct> Ccts { get { @@ -428,40 +450,40 @@ namespace Tango.DAL.Observables } - private FiberShape _fibershapes; + private FiberShape _fibershape; /// <summary> /// Gets or sets the rml fiber shapes. /// </summary> - [EntityFieldName("FIBER_SHAPES")] - public FiberShape FiberShapes + + public virtual FiberShape FiberShape { get { - return _fibershapes; + return _fibershape; } set { - _fibershapes = value; RaisePropertyChanged(nameof(FiberShapes)); + _fibershape = value; RaisePropertyChanged(nameof(FiberShape)); } } - private FiberSynth _fibersynths; + private FiberSynth _fibersynth; /// <summary> /// Gets or sets the rml fiber synths. /// </summary> - [EntityFieldName("FIBER_SYNTHS")] - public FiberSynth FiberSynths + + public virtual FiberSynth FiberSynth { get { - return _fibersynths; + return _fibersynth; } set { - _fibersynths = value; RaisePropertyChanged(nameof(FiberSynths)); + _fibersynth = value; RaisePropertyChanged(nameof(FiberSynth)); } } @@ -470,8 +492,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml jobs. /// </summary> - [EntityFieldName("JOBS")] - public ObservableCollection<Job> Jobs + + public virtual ObservableCollection<Job> Jobs { get { @@ -485,21 +507,21 @@ namespace Tango.DAL.Observables } - private LinearMassDensityUnit _linearmassdensityunits; + private LinearMassDensityUnit _linearmassdensityunit; /// <summary> /// Gets or sets the rml linear mass density units. /// </summary> - [EntityFieldName("LINEAR_MASS_DENSITY_UNITS")] - public LinearMassDensityUnit LinearMassDensityUnits + + public virtual LinearMassDensityUnit LinearMassDensityUnit { get { - return _linearmassdensityunits; + return _linearmassdensityunit; } set { - _linearmassdensityunits = value; RaisePropertyChanged(nameof(LinearMassDensityUnits)); + _linearmassdensityunit = value; RaisePropertyChanged(nameof(LinearMassDensityUnit)); } } @@ -508,8 +530,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml liquid types rmls. /// </summary> - [EntityFieldName("LIQUID_TYPES_RMLS")] - public ObservableCollection<LiquidTypesRml> LiquidTypesRmls + + public virtual ObservableCollection<LiquidTypesRml> LiquidTypesRmls { get { @@ -523,78 +545,78 @@ namespace Tango.DAL.Observables } - private MediaColor _mediacolors; + private MediaColor _mediacolor; /// <summary> /// Gets or sets the rml media colors. /// </summary> - [EntityFieldName("MEDIA_COLORS")] - public MediaColor MediaColors + + public virtual MediaColor MediaColor { get { - return _mediacolors; + return _mediacolor; } set { - _mediacolors = value; RaisePropertyChanged(nameof(MediaColors)); + _mediacolor = value; RaisePropertyChanged(nameof(MediaColor)); } } - private MediaCondition _mediaconditions; + private MediaCondition _mediacondition; /// <summary> /// Gets or sets the rml media conditions. /// </summary> - [EntityFieldName("MEDIA_CONDITIONS")] - public MediaCondition MediaConditions + + public virtual MediaCondition MediaCondition { get { - return _mediaconditions; + return _mediacondition; } set { - _mediaconditions = value; RaisePropertyChanged(nameof(MediaConditions)); + _mediacondition = value; RaisePropertyChanged(nameof(MediaCondition)); } } - private MediaMaterial _mediamaterials; + private MediaMaterial _mediamaterial; /// <summary> /// Gets or sets the rml media materials. /// </summary> - [EntityFieldName("MEDIA_MATERIALS")] - public MediaMaterial MediaMaterials + + public virtual MediaMaterial MediaMaterial { get { - return _mediamaterials; + return _mediamaterial; } set { - _mediamaterials = value; RaisePropertyChanged(nameof(MediaMaterials)); + _mediamaterial = value; RaisePropertyChanged(nameof(MediaMaterial)); } } - private MediaPurpos _mediapurposes; + private MediaPurpos _mediapurpose; /// <summary> /// Gets or sets the rml media purposes. /// </summary> - [EntityFieldName("MEDIA_PURPOSES")] - public MediaPurpos MediaPurposes + + public virtual MediaPurpos MediaPurpose { get { - return _mediapurposes; + return _mediapurpose; } set { - _mediapurposes = value; RaisePropertyChanged(nameof(MediaPurposes)); + _mediapurpose = value; RaisePropertyChanged(nameof(MediaPurpose)); } } @@ -603,8 +625,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rml process parameters tables groups. /// </summary> - [EntityFieldName("PROCESS_PARAMETERS_TABLES_GROUPS")] - public ObservableCollection<ProcessParametersTablesGroup> ProcessParametersTablesGroups + + public virtual ObservableCollection<ProcessParametersTablesGroup> ProcessParametersTablesGroups { get { @@ -623,24 +645,6 @@ namespace Tango.DAL.Observables /// </summary> public Rml() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Rml" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Rml(RML entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Cats = new ObservableCollection<Cat>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Role.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Role.cs index 0bcf1a390..e0a183544 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Role.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Role.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("ROLES")] - public partial class Role : ObservableEntity<ROLE> + [Table("ROLES")] + public partial class Role : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the role code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the role name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the role description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the role roles permissions. /// </summary> - [EntityFieldName("ROLES_PERMISSIONS")] - public ObservableCollection<RolesPermission> RolesPermissions + + public virtual ObservableCollection<RolesPermission> RolesPermissions { get { @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the role users roles. /// </summary> - [EntityFieldName("USERS_ROLES")] - public ObservableCollection<UsersRole> UsersRoles + + public virtual ObservableCollection<UsersRole> UsersRoles { get { @@ -110,24 +115,6 @@ namespace Tango.DAL.Observables /// </summary> public Role() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Role" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Role(ROLE entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { RolesPermissions = new ObservableCollection<RolesPermission>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/RolesPermission.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/RolesPermission.cs index 9c1919ada..8a2195331 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/RolesPermission.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/RolesPermission.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("ROLES_PERMISSIONS")] - public partial class RolesPermission : ObservableEntity<ROLES_PERMISSIONS> + [Table("ROLES_PERMISSIONS")] + public partial class RolesPermission : ObservableEntity { private String _roleguid; /// <summary> /// Gets or sets the rolespermission role guid. /// </summary> - [EntityFieldName("ROLE_GUID")] - public String RoleGuid + [Column("ROLE_GUID")] + [ForeignKey("Role")] + public String RoleGuid { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rolespermission permission guid. /// </summary> - [EntityFieldName("PERMISSION_GUID")] - public String PermissionGuid + [Column("PERMISSION_GUID")] + [ForeignKey("Permission")] + public String PermissionGuid { get { @@ -52,8 +56,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rolespermission permission. /// </summary> - [EntityFieldName("PERMISSION")] - public Permission Permission + + public virtual Permission Permission { get { @@ -71,8 +75,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the rolespermission role. /// </summary> - [EntityFieldName("ROLE")] - public Role Role + + public virtual Role Role { get { @@ -91,24 +95,6 @@ namespace Tango.DAL.Observables /// </summary> public RolesPermission() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="RolesPermission" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public RolesPermission(ROLES_PERMISSIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Segment.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Segment.cs index 9af744f6d..8fa4bb4f7 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Segment.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Segment.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("SEGMENTS")] - public partial class Segment : ObservableEntity<SEGMENT> + [Table("SEGMENTS")] + public partial class Segment : ObservableEntity { private String _name; /// <summary> /// Gets or sets the segment name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the segment job guid. /// </summary> - [EntityFieldName("JOB_GUID")] - public String JobGuid + [Column("JOB_GUID")] + [ForeignKey("Job")] + public String JobGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the segment length. /// </summary> - [EntityFieldName("LENGTH")] - public Double Length + [Column("LENGTH")] + + public Double Length { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the segment brush stops. /// </summary> - [EntityFieldName("BRUSH_STOPS")] - public ObservableCollection<BrushStop> BrushStops + + public virtual ObservableCollection<BrushStop> BrushStops { get { @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the segment job. /// </summary> - [EntityFieldName("JOB")] - public Job Job + + public virtual Job Job { get { @@ -110,24 +115,6 @@ namespace Tango.DAL.Observables /// </summary> public Segment() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Segment" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Segment(SEGMENT entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { BrushStops = new ObservableCollection<BrushStop>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Sensor.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Sensor.cs index c71a1524d..7d09a0cc2 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Sensor.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Sensor.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("SENSORS")] - public partial class Sensor : ObservableEntity<SENSOR> + [Table("SENSORS")] + public partial class Sensor : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the sensor code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor min. /// </summary> - [EntityFieldName("MIN")] - public Double Min + [Column("MIN")] + + public Double Min { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor max. /// </summary> - [EntityFieldName("MAX")] - public Double Max + [Column("MAX")] + + public Double Max { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor units. /// </summary> - [EntityFieldName("UNITS")] - public String Units + [Column("UNITS")] + + public String Units { get { @@ -128,8 +136,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor points per frame. /// </summary> - [EntityFieldName("POINTS_PER_FRAME")] - public Int32 PointsPerFrame + [Column("POINTS_PER_FRAME")] + + public Int32 PointsPerFrame { get { @@ -147,8 +156,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor multi channel. /// </summary> - [EntityFieldName("MULTI_CHANNEL")] - public Boolean MultiChannel + [Column("MULTI_CHANNEL")] + + public Boolean MultiChannel { get { @@ -166,8 +176,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the sensor channel count. /// </summary> - [EntityFieldName("CHANNEL_COUNT")] - public Int32 ChannelCount + [Column("CHANNEL_COUNT")] + + public Int32 ChannelCount { get { @@ -186,24 +197,6 @@ namespace Tango.DAL.Observables /// </summary> public Sensor() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="Sensor" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public Sensor(SENSOR entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/SyncConfiguration.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/SyncConfiguration.cs index 1b53b2b8b..2aac73502 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/SyncConfiguration.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/SyncConfiguration.cs @@ -1,13 +1,15 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("SYNC_CONFIGURATIONS")] - public partial class SyncConfiguration : ObservableEntity<SYNC_CONFIGURATIONS> + [Table("SYNC_CONFIGURATIONS")] + public partial class SyncConfiguration : ObservableEntity { /// <summary> @@ -15,24 +17,6 @@ namespace Tango.DAL.Observables /// </summary> public SyncConfiguration() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="SyncConfiguration" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public SyncConfiguration(SYNC_CONFIGURATIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/User.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/User.cs index 210488ac4..9739e5b62 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/User.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/User.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("USERS")] - public partial class User : ObservableEntity<USER> + [Table("USERS")] + public partial class User : ObservableEntity { private Boolean _deleted; /// <summary> /// Gets or sets the user deleted. /// </summary> - [EntityFieldName("DELETED")] - public Boolean Deleted + [Column("DELETED")] + + public Boolean Deleted { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user email. /// </summary> - [EntityFieldName("EMAIL")] - public String Email + [Column("EMAIL")] + + public String Email { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user password. /// </summary> - [EntityFieldName("PASSWORD")] - public String Password + [Column("PASSWORD")] + + public String Password { get { @@ -71,8 +76,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user organization guid. /// </summary> - [EntityFieldName("ORGANIZATION_GUID")] - public String OrganizationGuid + [Column("ORGANIZATION_GUID")] + [ForeignKey("Organization")] + public String OrganizationGuid { get { @@ -90,8 +96,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user contact guid. /// </summary> - [EntityFieldName("CONTACT_GUID")] - public String ContactGuid + [Column("CONTACT_GUID")] + [ForeignKey("Contact")] + public String ContactGuid { get { @@ -109,8 +116,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user address guid. /// </summary> - [EntityFieldName("ADDRESS_GUID")] - public String AddressGuid + [Column("ADDRESS_GUID")] + [ForeignKey("Address")] + public String AddressGuid { get { @@ -128,8 +136,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user address. /// </summary> - [EntityFieldName("ADDRESS")] - public Address Address + + public virtual Address Address { get { @@ -147,8 +155,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user contact. /// </summary> - [EntityFieldName("CONTACT")] - public Contact Contact + + public virtual Contact Contact { get { @@ -166,8 +174,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user machines events. /// </summary> - [EntityFieldName("MACHINES_EVENTS")] - public ObservableCollection<MachinesEvent> MachinesEvents + + public virtual ObservableCollection<MachinesEvent> MachinesEvents { get { @@ -185,8 +193,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user organization. /// </summary> - [EntityFieldName("ORGANIZATION")] - public Organization Organization + + public virtual Organization Organization { get { @@ -204,8 +212,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the user users roles. /// </summary> - [EntityFieldName("USERS_ROLES")] - public ObservableCollection<UsersRole> UsersRoles + + public virtual ObservableCollection<UsersRole> UsersRoles { get { @@ -224,24 +232,6 @@ namespace Tango.DAL.Observables /// </summary> public User() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="User" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public User(USER entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { MachinesEvents = new ObservableCollection<MachinesEvent>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/UsersRole.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/UsersRole.cs index 782c296e3..e96ea1fe4 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/UsersRole.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/UsersRole.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("USERS_ROLES")] - public partial class UsersRole : ObservableEntity<USERS_ROLES> + [Table("USERS_ROLES")] + public partial class UsersRole : ObservableEntity { private Boolean _deleted; /// <summary> /// Gets or sets the usersrole deleted. /// </summary> - [EntityFieldName("DELETED")] - public Boolean Deleted + [Column("DELETED")] + + public Boolean Deleted { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the usersrole user guid. /// </summary> - [EntityFieldName("USER_GUID")] - public String UserGuid + [Column("USER_GUID")] + [ForeignKey("User")] + public String UserGuid { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the usersrole role guid. /// </summary> - [EntityFieldName("ROLE_GUID")] - public String RoleGuid + [Column("ROLE_GUID")] + [ForeignKey("Role")] + public String RoleGuid { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the usersrole role. /// </summary> - [EntityFieldName("ROLE")] - public Role Role + + public virtual Role Role { get { @@ -90,8 +95,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the usersrole user. /// </summary> - [EntityFieldName("USER")] - public User User + + public virtual User User { get { @@ -110,24 +115,6 @@ namespace Tango.DAL.Observables /// </summary> public UsersRole() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="UsersRole" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public UsersRole(USERS_ROLES entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/WindingMethod.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/WindingMethod.cs index d8ffc8211..296774138 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/WindingMethod.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/WindingMethod.cs @@ -1,21 +1,24 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("WINDING_METHODS")] - public partial class WindingMethod : ObservableEntity<WINDING_METHODS> + [Table("WINDING_METHODS")] + public partial class WindingMethod : ObservableEntity { private Int32 _code; /// <summary> /// Gets or sets the windingmethod code. /// </summary> - [EntityFieldName("CODE")] - public Int32 Code + [Column("CODE")] + + public Int32 Code { get { @@ -33,8 +36,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the windingmethod name. /// </summary> - [EntityFieldName("NAME")] - public String Name + [Column("NAME")] + + public String Name { get { @@ -52,8 +56,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the windingmethod description. /// </summary> - [EntityFieldName("DESCRIPTION")] - public String Description + [Column("DESCRIPTION")] + + public String Description { get { @@ -71,8 +76,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the windingmethod jobs. /// </summary> - [EntityFieldName("JOBS")] - public ObservableCollection<Job> Jobs + + public virtual ObservableCollection<Job> Jobs { get { @@ -91,24 +96,6 @@ namespace Tango.DAL.Observables /// </summary> public WindingMethod() : base() { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="WindingMethod" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public WindingMethod(WINDING_METHODS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { Jobs = new ObservableCollection<Job>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods.cs b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods.cs index d334e1e6d..5911d7cfb 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Reflection; using System.Text; @@ -18,7 +19,7 @@ namespace Tango.DAL.Observables /// <returns></returns> public static String GetDALName(this Type type) { - return (type.GetCustomAttributes(typeof(EntityFieldNameAttribute), false).SingleOrDefault() as EntityFieldNameAttribute).Name; + return (type.GetCustomAttributes(typeof(TableAttribute), false).SingleOrDefault() as TableAttribute).Name; } /// <summary> @@ -27,7 +28,7 @@ namespace Tango.DAL.Observables /// <returns></returns> public static String GetDALName(this PropertyInfo prop) { - return (prop.GetCustomAttributes(typeof(EntityFieldNameAttribute), false).SingleOrDefault() as EntityFieldNameAttribute).Name; + return (prop.GetCustomAttributes(typeof(TableAttribute), false).SingleOrDefault() as TableAttribute).Name; } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ConfigurationExtensions.cs b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ConfigurationExtensions.cs index c3e14bca8..842670e02 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ConfigurationExtensions.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ConfigurationExtensions.cs @@ -24,9 +24,9 @@ public static class ConfigurationExtensions { IdsPack clonedPack = idsPack.CloneEntity(); clonedPack.Configuration = cloned; - clonedPack.DispenserTypes = idsPack.DispenserTypes; - clonedPack.CartridgeTypes = idsPack.CartridgeTypes; - clonedPack.MidTankTypes = idsPack.MidTankTypes; + clonedPack.DispenserType = idsPack.DispenserType; + clonedPack.CartridgeType = idsPack.CartridgeType; + clonedPack.MidTankType = idsPack.MidTankType; cloned.IdsPacks.Add(clonedPack); } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ObservableEntityExtensions.cs b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ObservableEntityExtensions.cs index bac3b18f8..8bb305026 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ObservableEntityExtensions.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ObservableEntityExtensions.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Tango.DAL.Observables; /// <summary> -/// Contains <see cref="ObservableEntity"/> extension methods. +/// Contains <see cref="ObservableEntityBase"/> extension methods. /// </summary> public static class ObservableEntityExtensions { diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ProcessParametersTablesGroupExtensions.cs b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ProcessParametersTablesGroupExtensions.cs index 17933840f..853570512 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ProcessParametersTablesGroupExtensions.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ExtensionMethods/ProcessParametersTablesGroupExtensions.cs @@ -15,7 +15,7 @@ public static class ProcessParametersTablesGroupExtensions foreach (var table in group.ProcessParametersTables) { var newTable = table.CloneEntity(); - newTable.ProcessParametersTablesGroups = cloned; + newTable.ProcessParametersTablesGroup = cloned; tables.Add(newTable); } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs b/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs index 71da4fa7c..62bfe9e86 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity; using System.Linq; using System.Text; @@ -13,21 +15,28 @@ namespace Tango.DAL.Observables public interface IObservableEntity { /// <summary> + /// Occurs after this observable has been saved. + /// </summary> + event EventHandler Saved; + + /// <summary> /// Gets or sets the entity identifier. /// </summary> - [EntityFieldName("ID")] + [Column("ID")] + [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] Int32 ID { get; set; } /// <summary> /// Gets or sets the entity unique identifier. /// </summary> - [EntityFieldName("GUID")] + [Key] + [Column("GUID")] String Guid { get; set; } /// <summary> /// Gets or sets the entity last updated data and time. /// </summary> - [EntityFieldName("LAST_UPDATED")] + [Column("LAST_UPDATED")] DateTime LastUpdated { get; set; } /// <summary> @@ -47,19 +56,13 @@ namespace Tango.DAL.Observables void Delete(); /// <summary> - /// Removed this entity from it's DB SET without saving changes. + /// Deletes this entity without saving changes to data base. /// </summary> - void SoftDelete(); + void DefferedDelete(); /// <summary> /// Deletes this entity from the database. /// </summary> Task DeleteAsync(); - - /// <summary> - /// Gets a collection of entities which are dependent on this entity. - /// </summary> - /// <returns>Collection of entities names and guids</returns> - List<KeyValuePair<String, String>> GetDependentEntitiesNameAndGuid(); } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs index 6e5fb76fe..493939ca4 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs @@ -15,270 +15,33 @@ using Tango.DAL.Remote; using Tango.Settings; using Tango.Core.Helpers; using Force.DeepCloner; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; namespace Tango.DAL.Observables { /// <summary> - /// Represents an observable entity base class. - /// </summary> - /// <seealso cref="Tango.Core.ExtendedObject" /> - /// <seealso cref="Tango.DAL.Observables.IObservableEntity" /> - public abstract class ObservableEntity : ExtendedObject, IObservableEntity - { - /// <summary> - /// Gets or sets the entity identifier. - /// </summary> - public abstract int ID { get; set; } - - /// <summary> - /// Gets or sets the entity unique identifier. - /// </summary> - public abstract string Guid { get; set; } - - /// <summary> - /// Gets or sets the entity last updated data and time. - /// </summary> - public abstract DateTime LastUpdated { get; set; } - - /// <summary> - /// Saves the changes on this entity to database. - /// </summary> - public abstract void Save(); - - /// <summary> - /// Internal recursive saving method. - /// </summary> - /// <param name="savedEntities">The saved entities.</param> - internal abstract void Save(List<IObservableEntity> savedEntities); - - /// <summary> - /// Deletes this entity from the database. - /// </summary> - public abstract void Delete(); - - /// <summary> - /// Removed this entity from it's DB SET without saving changes. - /// </summary> - public abstract void SoftDelete(); - - /// <summary> - /// Deletes this entity from the database - /// </summary> - public abstract Task DeleteAsync(); - - /// <summary> - /// Saves the changes on this entity to database asynchronously. - /// </summary> - /// <returns></returns> - public abstract Task SaveAsync(); - - /// <summary> - /// Converts the specified database conventional name to the observables conventional name. - /// </summary> - /// <param name="dalName">DAL name.</param> - /// <returns></returns> - public static String DalNameToStandardName(String dalName) - { - return String.Join("", dalName.Split('_').Select(x => ToTitleCase(x))); - } - - /// <summary> - /// Converts the specified text to title case. - /// </summary> - /// <param name="text">The text.</param> - /// <returns></returns> - public static string ToTitleCase(string text) - { - return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text.ToLower()); - } - - /// <summary> - /// Maps the database entity to an observable entity. - /// </summary> - /// <param name="entity">The entity.</param> - /// <param name="observable">The observable.</param> - protected static void MapEntityToObservable(Object entity, IObservableEntity observable) - { - String guid = entity.GetType().GetProperty("GUID").GetValue(entity).ToString(); - LoadedEntitiesService.Add(guid, observable); - - foreach (var prop in entity.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - String name = prop.Name == "ID" ? "ID" : DalNameToStandardName(prop.Name); - - if (prop.PropertyType.IsGenericType) - { - object observableCollection = observable.GetType().GetProperty(name).GetValue(observable); - - ThreadsHelper.InvokeUINow(() => observableCollection.GetType().GetMethod("Clear").Invoke(observableCollection, new object[] { })); - - Type genericType = observable.GetType().GetProperty(name).PropertyType.GenericTypeArguments.Single(); - - foreach (var item in prop.GetValue(entity) as IEnumerable) - { - guid = item.GetType().GetProperty("GUID").GetValue(item).ToString(); - - var loadedEntity = LoadedEntitiesService.Get(guid); - - if (loadedEntity != null) - { - ThreadsHelper.InvokeUINow(() => observableCollection.GetType().GetMethod("Add").Invoke(observableCollection, new object[] { loadedEntity })); - } - else - { - IObservableEntity newObservable = Activator.CreateInstance(genericType, new object[] { item }) as IObservableEntity; - LoadedEntitiesService.Add(guid, newObservable); - ThreadsHelper.InvokeUINow(() => observableCollection.GetType().GetMethod("Add").Invoke(observableCollection, new object[] { newObservable })); - } - } - } - else if (prop.PropertyType.IsClass && prop.PropertyType != typeof(String) && prop.PropertyType != typeof(DateTime) && prop.PropertyType != typeof(byte[])) - { - Type propType = observable.GetType().GetProperty(name).PropertyType; - - var nullableGuid = prop.GetValue(entity).GetType().GetProperty("GUID").GetValue(prop.GetValue(entity)); - - if (nullableGuid == null) - { - nullableGuid = System.Guid.NewGuid().ToString(); - prop.GetValue(entity).GetType().GetProperty("GUID").SetValue(prop.GetValue(entity), nullableGuid); - } - - guid = nullableGuid.ToString(); - - var loadedEntity = LoadedEntitiesService.Get(guid); - - if (loadedEntity != null) - { - observable.GetType().GetProperty(name).SetValue(observable, loadedEntity); - } - else - { - IObservableEntity newObservable = Activator.CreateInstance(propType, new object[] { prop.GetValue(entity) }) as IObservableEntity; - LoadedEntitiesService.Add(guid, newObservable); - observable.GetType().GetProperty(name).SetValue(observable, newObservable); - } - } - else - { - observable.GetType().GetProperty(name).SetValue(observable, prop.GetValue(entity)); - } - } - } - - /// <summary> - /// Creates an observable entity from the specified database entity. - /// </summary> - /// <typeparam name="TObservable">The type of the observable.</typeparam> - /// <param name="entity">The entity.</param> - /// <returns></returns> - public static TObservable CreateObservableFromEntity<TObservable>(Object entity) where TObservable : IObservableEntity - { - String guid = entity.GetType().GetProperty("GUID").GetValue(entity).ToString(); - var observable = LoadedEntitiesService.Get(guid); - - if (observable != null) - { - return (TObservable)observable; - } - else - { - return (TObservable)Activator.CreateInstance(typeof(TObservable), new object[] { entity }); - } - } - - /// <summary> - /// Gets a collection of entities which are dependent on this entity. - /// </summary> - /// <returns> - /// Collection of entities names and guids - /// </returns> - public List<KeyValuePair<String, String>> GetDependentEntitiesNameAndGuid() - { - List<KeyValuePair<String, String>> namesAndIds = new List<KeyValuePair<string, string>>(); - - foreach (var prop in this.GetType().GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType)) - { - IList list = prop.GetValue(this) as IList; - - foreach (var item in list) - { - namesAndIds.Add(new KeyValuePair<string, string>(item.GetType().Name, item.GetType().GetProperty("ID").GetValue(item).ToString())); - } - } - - return namesAndIds; - } - - #region Operator Overloading - - public static bool operator ==(ObservableEntity observable1, ObservableEntity observable2) - { - if (object.ReferenceEquals(observable1, null) || object.ReferenceEquals(observable2, null)) - { - return object.ReferenceEquals(observable1, observable2); - } - - return observable1.Guid.ToLower() == observable2.Guid.ToLower(); - } - - public static bool operator !=(ObservableEntity observable1, ObservableEntity observable2) - { - if (object.ReferenceEquals(observable1, null) || object.ReferenceEquals(observable2, null)) - { - return !object.ReferenceEquals(observable1, observable2); - } - - return observable1.Guid.ToLower() != observable2.Guid.ToLower(); - } - - public override bool Equals(object obj) - { - if (object.ReferenceEquals(this, null) || object.ReferenceEquals(obj, null)) - { - return object.ReferenceEquals(this, obj); - } - - if (obj is ObservableEntity) - { - return Guid.ToLower() == (obj as ObservableEntity).Guid.ToLower(); - } - else - { - return false; - } - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - #endregion - } - - /// <summary> /// Represents a generic observable entity base class. /// </summary> /// <typeparam name="T"></typeparam> /// <seealso cref="Tango.Core.ExtendedObject" /> /// <seealso cref="Tango.DAL.Observables.IObservableEntity" /> - public abstract class ObservableEntity<T> : ObservableEntity where T : class + public abstract class ObservableEntity : ExtendedObject, IObservableEntity { private Regex regExDAL; - private bool _isNew; /// <summary> - /// Gets or sets the entity. + /// Occurs after this observable has been saved. /// </summary> - protected T Entity { get; set; } + public event EventHandler Saved; private Int32 _id; /// <summary> /// Gets or sets the entity identifier. /// </summary> - [EntityFieldName("ID")] - public override Int32 ID + [Column("ID")] + [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] + public Int32 ID { get { return _id; } set { _id = value; RaisePropertyChanged(nameof(ID)); } @@ -288,8 +51,9 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the entity unique identifier. /// </summary> - [EntityFieldName("GUID")] - public override String Guid + [Key] + [Column("GUID")] + public String Guid { get { return _guid; } set { _guid = value; RaisePropertyChanged(nameof(Guid)); } @@ -299,8 +63,8 @@ namespace Tango.DAL.Observables /// <summary> /// Gets or sets the entity last updated data and time. /// </summary> - [EntityFieldName("LAST_UPDATED")] - public override DateTime LastUpdated + [Column("LAST_UPDATED")] + public DateTime LastUpdated { get { return _lastUpdated; } set { _lastUpdated = value; RaisePropertyChanged(nameof(LastUpdated)); } @@ -311,20 +75,8 @@ namespace Tango.DAL.Observables /// </summary> public ObservableEntity() { - Entity = Activator.CreateInstance<T>(); Guid = System.Guid.NewGuid().ToString(); LastUpdated = DateTime.UtcNow; - _isNew = true; - } - - /// <summary> - /// Initializes a new instance of the <see cref="ObservableEntity{T}"/> class. - /// </summary> - /// <param name="entity">The entity.</param> - public ObservableEntity(T entity) - { - Entity = entity; - regExDAL = new Regex(@" (?<=[A-Z])(?=[A-Z][a-z]) | (?<=[^A-Z])(?=[A-Z]) | @@ -334,17 +86,17 @@ namespace Tango.DAL.Observables /// <summary> /// Saves the changes on this entity to database. /// </summary> - public override void Save() + public virtual void Save() { - Save(new List<IObservableEntity>()); ObservablesEntitiesAdapter.Instance.SaveChanges(); + Saved?.Invoke(this, new EventArgs()); } /// <summary> /// Saves the changes on this entity to database asynchronously. /// </summary> /// <returns></returns> - public override Task SaveAsync() + public Task SaveAsync() { return Task.Factory.StartNew(() => { @@ -355,7 +107,7 @@ namespace Tango.DAL.Observables /// <summary> /// Deletes this entity from the database /// </summary> - public override void Delete() + public virtual void Delete() { var delProp = this.GetType().GetProperty("Deleted"); @@ -366,36 +118,31 @@ namespace Tango.DAL.Observables } else { - String tabelName = this.GetType().GetDALName(); - DbSet<T> dbSet = typeof(RemoteDB).GetProperty(tabelName).GetValue(ObservablesEntitiesAdapter.Instance.Context) as DbSet<T>; - dbSet.Remove(Entity); + String tabelName = this.GetType().BaseType.Name.PluralizeMVC(); + var p = typeof(ObservablesContext).GetProperty(tabelName); + var dbSet = p.GetValue(ObservablesEntitiesAdapter.Instance.Context); + var method = dbSet.GetType().GetMethod("Remove"); + method.Invoke(dbSet, new object[] { this }); ObservablesEntitiesAdapter.Instance.SaveChanges(); } } /// <summary> - /// Removed this entity from it's DB SET without saving changes. + /// Deletes this entity without saving changes to data base. /// </summary> - public override void SoftDelete() + public virtual void DefferedDelete() { - var delProp = this.GetType().GetProperty("IsDeleted"); - - if (delProp != null) - { - delProp.SetValue(this, true); - } - else - { - String tabelName = this.GetType().GetDALName(); - DbSet<T> dbSet = typeof(RemoteDB).GetProperty(tabelName).GetValue(ObservablesEntitiesAdapter.Instance.Context) as DbSet<T>; - dbSet.Remove(Entity); - } + String tabelName = this.GetType().BaseType.Name.PluralizeMVC(); + var p = typeof(ObservablesContext).GetProperty(tabelName); + var dbSet = p.GetValue(ObservablesEntitiesAdapter.Instance.Context); + var method = dbSet.GetType().GetMethod("Remove"); + method.Invoke(dbSet, new object[] { this }); } /// <summary> /// Deletes this entity from the database /// </summary> - public override Task DeleteAsync() + public Task DeleteAsync() { return Task.Factory.StartNew(() => { @@ -404,90 +151,69 @@ namespace Tango.DAL.Observables } /// <summary> - /// Internal recursive saving method. + /// Converts the specified database conventional name to the observables conventional name. /// </summary> - /// <param name="savedEntities">The saved entities.</param> - internal override void Save(List<IObservableEntity> savedEntities) + /// <param name="dalName">DAL name.</param> + /// <returns></returns> + public static String DalNameToStandardName(String dalName) { - savedEntities.Add(this); - - //Update last updated... - this.LastUpdated = DateTime.UtcNow; - - //Match guids.. - - foreach (var prop in this.GetType().GetPropertiesWithAttribute<EntityFieldNameAttribute>().Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && x.PropertyType != typeof(String) && x.PropertyType != typeof(DateTime) && x.PropertyType != typeof(byte[]))) - { - IObservableEntity propObservable = prop.GetValue(this) as IObservableEntity; + return String.Join("", dalName.Split('_').Select(x => ToTitleCase(x))); + } - if (propObservable != null) - { - var guidProp = this.GetType().GetProperty(prop.Name + "Guid"); + /// <summary> + /// Converts the specified text to title case. + /// </summary> + /// <param name="text">The text.</param> + /// <returns></returns> + public static string ToTitleCase(string text) + { + return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text.ToLower()); + } - if (guidProp != null) - { - guidProp.SetValue(this, propObservable.Guid); - } - else - { - guidProp = this.GetType().GetProperty(prop.Name.SingularizeMVC() + "Guid"); - if (guidProp != null) - { - guidProp.SetValue(this, propObservable.Guid); - } - } - } - } + #region Operator Overloading - //Match guids.. + //public static bool operator ==(ObservableEntityBase observable1, ObservableEntityBase observable2) + //{ + // if (object.ReferenceEquals(observable1, null) || object.ReferenceEquals(observable2, null)) + // { + // return object.ReferenceEquals(observable1, observable2); + // } - using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false)) - { - foreach (var prop in this.GetType().GetPropertiesWithAttribute<EntityFieldNameAttribute>().OrderBy(x => x.PropertyType.IsPrimitive)) - { + // return observable1.Guid.ToLower() == observable2.Guid.ToLower(); + //} - String dalName = prop.GetDALName(); + //public static bool operator !=(ObservableEntityBase observable1, ObservableEntityBase observable2) + //{ + // if (object.ReferenceEquals(observable1, null) || object.ReferenceEquals(observable2, null)) + // { + // return !object.ReferenceEquals(observable1, observable2); + // } - if (prop.PropertyType.IsGenericType) - { - foreach (var item in (prop.GetValue(this) as IEnumerable).OfType<ObservableEntity>()) - { - if (!savedEntities.Contains(item)) - { - item.Save(savedEntities); - } - } - } - else if (prop.PropertyType.IsClass && prop.PropertyType != typeof(String) && prop.PropertyType != typeof(DateTime) && prop.PropertyType != typeof(byte[])) - { - var item = (prop.GetValue(this) as ObservableEntity); - if (!savedEntities.Contains(item)) - { - item.Save(savedEntities); - } - var propEntityType = prop.PropertyType.GetProperty("Entity", BindingFlags.NonPublic | BindingFlags.Instance); - typeof(T).GetProperty(dalName).SetValue(Entity, propEntityType.GetValue((prop.GetValue(this)))); - } - else - { - typeof(T).GetProperty(dalName).SetValue(Entity, prop.GetValue(this)); - } - } + // return observable1.Guid.ToLower() != observable2.Guid.ToLower(); + //} - if (_isNew) - { - String tabelName = this.GetType().GetDALName(); - DbSet<T> dbSet = typeof(RemoteDB).GetProperty(tabelName).GetValue(ObservablesEntitiesAdapter.Instance.Context) as DbSet<T>; - dbSet.Add(Entity); - } + //public override bool Equals(object obj) + //{ + // if (object.ReferenceEquals(this, null) || object.ReferenceEquals(obj, null)) + // { + // return object.ReferenceEquals(this, obj); + // } - if (LoadedEntitiesService.IsLoaded(this.Guid)) - { - MapEntityToObservable(Entity, this); - } + // if (obj is ObservableEntityBase) + // { + // return Guid.ToLower() == (obj as ObservableEntityBase).Guid.ToLower(); + // } + // else + // { + // return false; + // } + //} - _isNew = false; - } + public override int GetHashCode() + { + return base.GetHashCode(); } + + #endregion } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesContext.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesContext.cs new file mode 100644 index 000000000..52310d446 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesContext.cs @@ -0,0 +1,443 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.DAL.Observables +{ + public class ObservablesContext : DbContext + { + /// <summary> + /// Initializes a new instance of the <see cref="ObservablesContext" /> class. + /// </summary> + /// <param name="path">The server file path.</param> + /// <param name="isFile">if set to <c>true</c> will try to connect to an .mdf file.</param> + public ObservablesContext(String path, bool isFile) : base(ComposeConnectionString(path, isFile)) + { + + } + + /// <summary> + /// Composes the connection string. + ///</summary> + /// <param name="source">The source.</param> + /// <param name="isFile">if set to <c>true</c> [is file].</param> + /// <returns></returns> + private static String ComposeConnectionString(String source, bool isFile) + { + if (!isFile) + { + return String.Format("Data Source={0};Initial Catalog=Tango;Integrated Security=true", source); + } + else + { + return null; + } + } + + /// <summary> + /// Creates a default remote database context by the address specified in <see cref="SettingsManager.Default.DataBase.SQLServerAddress" />. + /// </summary> + /// <returns></returns> + public static ObservablesContext CreateDefault() + { + return new ObservablesContext(SettingsManager.Default.DataBase.SQLServerAddress, false); + } + + /// <summary> + /// Gets or sets the ActionTypes. + /// </summary> + public DbSet<ActionType> ActionTypes + { + get; set; + } + + /// <summary> + /// Gets or sets the Addresses. + /// </summary> + public DbSet<Address> Addresses + { + get; set; + } + + /// <summary> + /// Gets or sets the ApplicationDisplayPanelVersions. + /// </summary> + public DbSet<ApplicationDisplayPanelVersion> ApplicationDisplayPanelVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the ApplicationFirmwareVersions. + /// </summary> + public DbSet<ApplicationFirmwareVersion> ApplicationFirmwareVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the ApplicationOsVersions. + /// </summary> + public DbSet<ApplicationOsVersion> ApplicationOsVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the ApplicationVersions. + /// </summary> + public DbSet<ApplicationVersion> ApplicationVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the BrushStops. + /// </summary> + public DbSet<BrushStop> BrushStops + { + get; set; + } + + /// <summary> + /// Gets or sets the CartridgeTypes. + /// </summary> + public DbSet<CartridgeType> CartridgeTypes + { + get; set; + } + + /// <summary> + /// Gets or sets the Cats. + /// </summary> + public DbSet<Cat> Cats + { + get; set; + } + + /// <summary> + /// Gets or sets the Ccts. + /// </summary> + public DbSet<Cct> Ccts + { + get; set; + } + + /// <summary> + /// Gets or sets the ColorSpaces. + /// </summary> + public DbSet<ColorSpace> ColorSpaces + { + get; set; + } + + /// <summary> + /// Gets or sets the Configurations. + /// </summary> + public DbSet<Configuration> Configurations + { + get; set; + } + + /// <summary> + /// Gets or sets the Contacts. + /// </summary> + public DbSet<Contact> Contacts + { + get; set; + } + + /// <summary> + /// Gets or sets the DispenserTypes. + /// </summary> + public DbSet<DispenserType> DispenserTypes + { + get; set; + } + + /// <summary> + /// Gets or sets the EmbeddedFirmwareVersions. + /// </summary> + public DbSet<EmbeddedFirmwareVersion> EmbeddedFirmwareVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the EmbeddedSoftwareVersions. + /// </summary> + public DbSet<EmbeddedSoftwareVersion> EmbeddedSoftwareVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the EventTypes. + /// </summary> + public DbSet<EventType> EventTypes + { + get; set; + } + + /// <summary> + /// Gets or sets the EventTypesActions. + /// </summary> + public DbSet<EventTypesAction> EventTypesActions + { + get; set; + } + + /// <summary> + /// Gets or sets the FiberShapes. + /// </summary> + public DbSet<FiberShape> FiberShapes + { + get; set; + } + + /// <summary> + /// Gets or sets the FiberSynths. + /// </summary> + public DbSet<FiberSynth> FiberSynths + { + get; set; + } + + /// <summary> + /// Gets or sets the HardwareVersions. + /// </summary> + public DbSet<HardwareVersion> HardwareVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the IdsPacks. + /// </summary> + public DbSet<IdsPack> IdsPacks + { + get; set; + } + + /// <summary> + /// Gets or sets the JobRuns. + /// </summary> + public DbSet<JobRun> JobRuns + { + get; set; + } + + /// <summary> + /// Gets or sets the Jobs. + /// </summary> + public DbSet<Job> Jobs + { + get; set; + } + + /// <summary> + /// Gets or sets the LinearMassDensityUnits. + /// </summary> + public DbSet<LinearMassDensityUnit> LinearMassDensityUnits + { + get; set; + } + + /// <summary> + /// Gets or sets the LiquidTypes. + /// </summary> + public DbSet<LiquidType> LiquidTypes + { + get; set; + } + + /// <summary> + /// Gets or sets the LiquidTypesRmls. + /// </summary> + public DbSet<LiquidTypesRml> LiquidTypesRmls + { + get; set; + } + + /// <summary> + /// Gets or sets the MachineVersions. + /// </summary> + public DbSet<MachineVersion> MachineVersions + { + get; set; + } + + /// <summary> + /// Gets or sets the Machines. + /// </summary> + public DbSet<Machine> Machines + { + get; set; + } + + /// <summary> + /// Gets or sets the MachinesConfigurations. + /// </summary> + public DbSet<MachinesConfiguration> MachinesConfigurations + { + get; set; + } + + /// <summary> + /// Gets or sets the MachinesEvents. + /// </summary> + public DbSet<MachinesEvent> MachinesEvents + { + get; set; + } + + /// <summary> + /// Gets or sets the MediaColors. + /// </summary> + public DbSet<MediaColor> MediaColors + { + get; set; + } + + /// <summary> + /// Gets or sets the MediaConditions. + /// </summary> + public DbSet<MediaCondition> MediaConditions + { + get; set; + } + + /// <summary> + /// Gets or sets the MediaMaterials. + /// </summary> + public DbSet<MediaMaterial> MediaMaterials + { + get; set; + } + + /// <summary> + /// Gets or sets the MediaPurposes. + /// </summary> + public DbSet<MediaPurpos> MediaPurposes + { + get; set; + } + + /// <summary> + /// Gets or sets the MidTankTypes. + /// </summary> + public DbSet<MidTankType> MidTankTypes + { + get; set; + } + + /// <summary> + /// Gets or sets the Organizations. + /// </summary> + public DbSet<Organization> Organizations + { + get; set; + } + + /// <summary> + /// Gets or sets the Permissions. + /// </summary> + public DbSet<Permission> Permissions + { + get; set; + } + + /// <summary> + /// Gets or sets the ProcessParametersTables. + /// </summary> + public DbSet<ProcessParametersTable> ProcessParametersTables + { + get; set; + } + + /// <summary> + /// Gets or sets the ProcessParametersTablesGroups. + /// </summary> + public DbSet<ProcessParametersTablesGroup> ProcessParametersTablesGroups + { + get; set; + } + + /// <summary> + /// Gets or sets the Rmls. + /// </summary> + public DbSet<Rml> Rmls + { + get; set; + } + + /// <summary> + /// Gets or sets the Roles. + /// </summary> + public DbSet<Role> Roles + { + get; set; + } + + /// <summary> + /// Gets or sets the RolesPermissions. + /// </summary> + public DbSet<RolesPermission> RolesPermissions + { + get; set; + } + + /// <summary> + /// Gets or sets the Segments. + /// </summary> + public DbSet<Segment> Segments + { + get; set; + } + + /// <summary> + /// Gets or sets the Sensors. + /// </summary> + public DbSet<Sensor> Sensors + { + get; set; + } + + /// <summary> + /// Gets or sets the SyncConfigurations. + /// </summary> + public DbSet<SyncConfiguration> SyncConfigurations + { + get; set; + } + + /// <summary> + /// Gets or sets the Users. + /// </summary> + public DbSet<User> Users + { + get; set; + } + + /// <summary> + /// Gets or sets the UsersRoles. + /// </summary> + public DbSet<UsersRole> UsersRoles + { + get; set; + } + + /// <summary> + /// Gets or sets the WindingMethods. + /// </summary> + public DbSet<WindingMethod> WindingMethods + { + get; set; + } + + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs index 9dc6b553a..eff9e274d 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs @@ -45,7 +45,7 @@ namespace Tango.DAL.Observables /// <summary> /// Gets the DB context. /// </summary> - public RemoteDB Context { get; private set; } + public ObservablesContext Context { get; private set; } /// <summary> /// Performs an implicit conversion from <see cref="ObservablesEntitiesAdapter"/> to <see cref="DbContext"/>. @@ -64,7 +64,7 @@ namespace Tango.DAL.Observables /// </summary> private ObservablesEntitiesAdapter() { - Context = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false); + Context = new ObservablesContext(SettingsManager.Default.DataBase.SQLServerAddress, false); } /// <summary> @@ -120,21 +120,21 @@ namespace Tango.DAL.Observables if (initializing) { //Remove Unlinked Configurations.. - List<CONFIGURATION> remove_configurations = new List<CONFIGURATION>(); + List<Configuration> remove_configurations = new List<Configuration>(); - foreach (var config in Context.CONFIGURATIONS) + foreach (var config in Context.Configurations) { - if (Context.MACHINE_VERSIONS.FirstOrDefault(x => x.DEFAULT_CONFIGURATION_GUID == config.GUID) != null) + if (Context.MachineVersions.FirstOrDefault(x => x.DefaultConfigurationGuid == config.Guid) != null) { continue; } - if (Context.MACHINES_CONFIGURATIONS.FirstOrDefault(x => x.CONFIGURATION_GUID == config.GUID) != null) + if (Context.MachinesConfigurations.FirstOrDefault(x => x.ConfigurationGuid == config.Guid) != null) { continue; } - if (Context.MACHINES.FirstOrDefault(x => x.CONFIGURATION_GUID == config.GUID) != null) + if (Context.Machines.FirstOrDefault(x => x.ConfigurationGuid == config.Guid) != null) { continue; } @@ -144,18 +144,16 @@ namespace Tango.DAL.Observables foreach (var config in remove_configurations) { - Context.CONFIGURATIONS.Remove(config); + Context.Configurations.Remove(config); } Context.SaveChanges(); //Remove Unlinked Configurations.. } - Organizations = Context.ORGANIZATIONS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Organization>(x)).ToObservableCollection(); + Organizations = Context.Organizations.ToObservableCollection(); - OrganizationsViewSource = CreateCollectionView(Organizations); - - Machines = Context.MACHINES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Machine>(x)).ToObservableCollection(); + Machines = Context.Machines.ToObservableCollection(); foreach (var machine in Machines) { @@ -163,111 +161,124 @@ namespace Tango.DAL.Observables machine.Jobs = machine.Jobs.OrderByDescending(x => x.CreationDate).ToObservableCollection(); } - MachinesConfigurations = Context.MACHINES_CONFIGURATIONS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MachinesConfiguration>(x)).ToObservableCollection(); + MachinesConfigurations = Context.MachinesConfigurations.ToObservableCollection(); - MachineVersions = Context.MACHINE_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<MachineVersion>(x)).ToObservableCollection(); + MachineVersions = Context.MachineVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - Addresses = Context.ADDRESSES.Where(x => !x.DELETED).ToList().OrderBy(x => x.ADDRESS_STRING).Select(x => ObservableEntity.CreateObservableFromEntity<Address>(x)).ToObservableCollection(); - Contacts = Context.CONTACTS.Where(x => !x.DELETED).ToList().OrderBy(x => x.FULL_NAME).Select(x => ObservableEntity.CreateObservableFromEntity<Contact>(x)).ToObservableCollection(); + Addresses = Context.Addresses.Where(x => !x.Deleted).ToList().OrderBy(x => x.AddressString).ToObservableCollection(); + Contacts = Context.Contacts.Where(x => !x.Deleted).ToList().OrderBy(x => x.FullName).ToObservableCollection(); - Roles = Context.ROLES.ToList().OrderBy(x => x.NAME).Select(x => ObservableEntity.CreateObservableFromEntity<Role>(x)).ToObservableCollection(); + Roles = Context.Roles.ToList().OrderBy(x => x.Name).ToObservableCollection(); - Permissions = Context.PERMISSIONS.ToList().OrderBy(x => x.NAME).Select(x => ObservableEntity.CreateObservableFromEntity<Permission>(x)).ToObservableCollection(); + Permissions = Context.Permissions.ToList().OrderBy(x => x.Name).ToObservableCollection(); - Users = Context.USERS.Where(x => !x.DELETED).ToList().OrderBy(x => x.CONTACT.FULL_NAME).Select(x => ObservableEntity.CreateObservableFromEntity<User>(x)).ToObservableCollection(); + UsersRoles = Context.UsersRoles.ToObservableCollection(); - foreach (var user in Users) - { - user.UsersRoles = user.UsersRoles.Where(x => !x.Deleted).ToObservableCollection(); - } + Users = Context.Users.Where(x => !x.Deleted).ToList().OrderBy(x => x.Contact.FullName).ToObservableCollection(); + + //foreach (var user in Users) + //{ + // user.UsersRoles = user.UsersRoles.Where(x => !x.Deleted).ToObservableCollection(); + //} foreach (var role in Roles) { role.RolesPermissions = role.RolesPermissions.ToObservableCollection(); } - Configurations = Context.CONFIGURATIONS.ToList().OrderBy(x => x.LAST_UPDATED).Select(x => ObservableEntity.CreateObservableFromEntity<Configuration>(x)).ToObservableCollection(); + Configurations = Context.Configurations.ToList().OrderBy(x => x.LastUpdated).ToObservableCollection(); foreach (var config in Configurations) { config.IdsPacks = config.IdsPacks.ToObservableCollection(); } - ApplicationVersions = Context.APPLICATION_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationVersion>(x)).ToObservableCollection(); + ApplicationVersions = Context.ApplicationVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); + + ApplicationOsVersions = Context.ApplicationOsVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - ApplicationOsVersions = Context.APPLICATION_OS_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationOsVersion>(x)).ToObservableCollection(); + ApplicationFirmwareVersions = Context.ApplicationFirmwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - ApplicationFirmwareVersions = Context.APPLICATION_FIRMWARE_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationFirmwareVersion>(x)).ToObservableCollection(); + ApplicationDisplayPanelVersions = Context.ApplicationDisplayPanelVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - ApplicationDisplayPanelVersions = Context.APPLICATION_DISPLAY_PANEL_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationDisplayPanelVersion>(x)).ToObservableCollection(); + EmbeddedFirmwareVersions = Context.EmbeddedFirmwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - EmbeddedFirmwareVersions = Context.EMBEDDED_FIRMWARE_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<EmbeddedFirmwareVersion>(x)).ToObservableCollection(); + EmbeddedSoftwareVersions = Context.EmbeddedSoftwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - EmbeddedSoftwareVersions = Context.EMBEDDED_SOFTWARE_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<EmbeddedSoftwareVersion>(x)).ToObservableCollection(); + HardwareVersions = Context.HardwareVersions.ToList().OrderBy(x => x.Version).ToObservableCollection(); - HardwareVersions = Context.HARDWARE_VERSIONS.ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<HardwareVersion>(x)).ToObservableCollection(); + IdsPacks = Context.IdsPacks.ToObservableCollection(); - IdsPacks = Context.IDS_PACKS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<IdsPack>(x)).ToObservableCollection(); + DispenserTypes = Context.DispenserTypes.ToObservableCollection(); - DispenserTypes = Context.DISPENSER_TYPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<DispenserType>(x)).ToObservableCollection(); + LiquidTypes = Context.LiquidTypes.ToObservableCollection(); - LiquidTypes = Context.LIQUID_TYPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<LiquidType>(x)).ToObservableCollection(); + CartridgeTypes = Context.CartridgeTypes.ToObservableCollection(); - CartridgeTypes = Context.CARTRIDGE_TYPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<CartridgeType>(x)).ToObservableCollection(); + MidTankTypes = Context.MidTankTypes.ToObservableCollection(); - MidTankTypes = Context.MID_TANK_TYPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MidTankType>(x)).ToObservableCollection(); + ActionTypes = Context.ActionTypes.ToObservableCollection(); - ActionTypes = Context.ACTION_TYPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<ActionType>(x)).ToObservableCollection(); + EventTypesActions = Context.EventTypesActions.ToObservableCollection(); - EventTypes = Context.EVENT_TYPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<EventType>(x)).ToObservableCollection(); + EventTypes = Context.EventTypes.ToObservableCollection(); foreach (var eventType in EventTypes) { eventType.EventTypesActions = eventType.EventTypesActions.ToObservableCollection(); } - MediaMaterials = Context.MEDIA_MATERIALS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaMaterial>(x)).ToObservableCollection(); + MediaMaterials = Context.MediaMaterials.ToObservableCollection(); - MediaColors = Context.MEDIA_COLORS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaColor>(x)).ToObservableCollection(); + MediaColors = Context.MediaColors.ToObservableCollection(); - MediaPurposes = Context.MEDIA_PURPOSES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaPurpos>(x)).ToObservableCollection(); + MediaPurposes = Context.MediaPurposes.ToObservableCollection(); - MediaConditions = Context.MEDIA_CONDITIONS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<MediaCondition>(x)).ToObservableCollection(); + MediaConditions = Context.MediaConditions.ToObservableCollection(); - LinearMassDensityUnits = Context.LINEAR_MASS_DENSITY_UNITS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<LinearMassDensityUnit>(x)).ToObservableCollection(); + LinearMassDensityUnits = Context.LinearMassDensityUnits.ToObservableCollection(); - FiberShapes = Context.FIBER_SHAPES.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<FiberShape>(x)).ToObservableCollection(); + FiberShapes = Context.FiberShapes.ToObservableCollection(); - FiberSynths = Context.FIBER_SYNTHS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<FiberSynth>(x)).ToObservableCollection(); + FiberSynths = Context.FiberSynths.ToObservableCollection(); - Rmls = Context.RMLS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Rml>(x)).ToObservableCollection(); + Rmls = Context.Rmls.ToObservableCollection(); - LiquidTypesRmls = Context.LIQUID_TYPES_RMLS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<LiquidTypesRml>(x)).ToObservableCollection(); + LiquidTypesRmls = Context.LiquidTypesRmls.ToObservableCollection(); - Ccts = Context.CCTS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Cct>(x)).ToObservableCollection(); + Ccts = Context.Ccts.ToObservableCollection(); - Cats = Context.CATS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Cat>(x)).ToObservableCollection(); + Cats = Context.Cats.ToObservableCollection(); - ProcessParametersTables = Context.PROCESS_PARAMETERS_TABLES.OrderBy(x => x.TABLE_INDEX).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<ProcessParametersTable>(x)).ToObservableCollection(); + ProcessParametersTables = Context.ProcessParametersTables.ToObservableCollection(); - ProcessParametersTablesGroups = Context.PROCESS_PARAMETERS_TABLES_GROUPS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<ProcessParametersTablesGroup>(x)).ToObservableCollection(); + ProcessParametersTablesGroups = Context.ProcessParametersTablesGroups.ToObservableCollection(); foreach (var group in ProcessParametersTablesGroups) { group.ProcessParametersTables = group.ProcessParametersTables.OrderBy(x => x.TableIndex).ToObservableCollection(); } - WindingMethods = Context.WINDING_METHODS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<WindingMethod>(x)).ToObservableCollection(); + WindingMethods = Context.WindingMethods.ToObservableCollection(); - Sensors = Context.SENSORS.ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Sensor>(x)).ToObservableCollection(); + Sensors = Context.Sensors.ToObservableCollection(); InitCollectionSources(); + //var action = ActionTypes.First(); + + //action.Name = "Action 1 Yesss"; + + //SaveChanges(); + //BindingOperations.EnableCollectionSynchronization(Machines, _syncLock); //BindingOperations.EnableCollectionSynchronization(MachinesViewSource, _syncLock); //BindingOperations.EnableCollectionSynchronization(MachinesConfigurations, _syncLock); //BindingOperations.EnableCollectionSynchronization(MachinesConfigurationsViewSource, _syncLock); + + //BindingOperations.EnableCollectionSynchronization(EventTypesActions, _syncLock); + //BindingOperations.EnableCollectionSynchronization(EventTypesActionsViewSource, _syncLock); } /// <summary> diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Partials/Machine.cs b/Software/Visual_Studio/Tango.DAL.Observables/Partials/Machine.cs index 71c1eeaee..c9782c91b 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Partials/Machine.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Partials/Machine.cs @@ -15,11 +15,11 @@ namespace Tango.DAL.Observables { foreach (var machine_config in MachinesConfigurations) { - machine_config.SoftDelete(); - machine_config.Configuration.SoftDelete(); + machine_config.Delete(); + machine_config.Configuration.Delete(); } - base.SoftDelete(); + base.Delete(); ObservablesEntitiesAdapter.Instance.SaveChanges(); } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Partials/MachineVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Partials/MachineVersion.cs index 95f4b0d69..e027468dd 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Partials/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Partials/MachineVersion.cs @@ -10,8 +10,8 @@ namespace Tango.DAL.Observables { public override void Delete() { - Configuration.SoftDelete(); - base.SoftDelete(); + this.DefaultConfiguration.Delete(); + base.Delete(); ObservablesEntitiesAdapter.Instance.SaveChanges(); } 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 670b9571d..ed5cadaa8 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj +++ b/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj @@ -101,6 +101,7 @@ <Compile Include="ExtensionMethods\ProcessParametersTablesGroupExtensions.cs" /> <Compile Include="IObservableEntity.cs" /> <Compile Include="LoadedEntitiesService.cs" /> + <Compile Include="ObservablesContext.cs" /> <Compile Include="Partials\Machine.cs" /> <Compile Include="ObservableEntity.cs" /> <Compile Include="ObservablesEntitiesAdapter.cs" /> @@ -165,7 +166,8 @@ <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> - <PreBuildEvent>"$(TargetDir)dbobgen.exe" "$(SolutionDir)Tango.DAL.Observables" -csharp</PreBuildEvent> + <PreBuildEvent> + </PreBuildEvent> </PropertyGroup> <PropertyGroup> <PostBuildEvent> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index c6edc62b3..b6780f7d6 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -30,10 +30,10 @@ namespace Tango.DAL.Remote.DB public string NAME { get; set; } public string MANUFACTURER { get; set; } public int CODE { get; set; } - public string MATERIAL_GUID { get; set; } - public string COLOR_GUID { get; set; } - public string PURPOSE_GUID { get; set; } - public string CONDITION_GUID { get; set; } + public string MEDIA_MATERIAL_GUID { get; set; } + public string MEDIA_COLOR_GUID { get; set; } + public string MEDIA_PURPOSE_GUID { get; set; } + public string MEDIA_CONDITION_GUID { get; set; } public string LINEAR_MASS_DENSITY_UNIT_GUID { get; set; } public string FIBER_SHAPE_GUID { get; set; } public string FIBER_SYNTH_GUID { 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 50ffe89cf..46919f0ab 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -503,10 +503,10 @@ <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="MANUFACTURER" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="CODE" Type="int" Nullable="false" /> - <Property Name="MATERIAL_GUID" Type="varchar" MaxLength="36" Nullable="false" /> - <Property Name="COLOR_GUID" Type="varchar" MaxLength="36" Nullable="false" /> - <Property Name="PURPOSE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> - <Property Name="CONDITION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="MEDIA_MATERIAL_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="MEDIA_COLOR_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="MEDIA_PURPOSE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="MEDIA_CONDITION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LINEAR_MASS_DENSITY_UNIT_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="FIBER_SHAPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="FIBER_SYNTH_GUID" Type="varchar" MaxLength="36" Nullable="false" /> @@ -1136,7 +1136,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RMLS"> - <PropertyRef Name="COLOR_GUID" /> + <PropertyRef Name="MEDIA_COLOR_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -1148,7 +1148,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RMLS"> - <PropertyRef Name="CONDITION_GUID" /> + <PropertyRef Name="MEDIA_CONDITION_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -1160,7 +1160,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RMLS"> - <PropertyRef Name="MATERIAL_GUID" /> + <PropertyRef Name="MEDIA_MATERIAL_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -1172,7 +1172,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RMLS"> - <PropertyRef Name="PURPOSE_GUID" /> + <PropertyRef Name="MEDIA_PURPOSE_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -1265,7 +1265,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_USERS_ROLES_USERS"> - <End Role="USERS" Type="Self.USERS" Multiplicity="1" /> + <End Role="USERS" Type="Self.USERS" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Role="USERS_ROLES" Type="Self.USERS_ROLES" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="USERS"> @@ -2384,10 +2386,10 @@ <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="MANUFACTURER" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="CODE" Type="Int32" Nullable="false" /> - <Property Name="MATERIAL_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <Property Name="COLOR_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <Property Name="PURPOSE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <Property Name="CONDITION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="MEDIA_MATERIAL_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="MEDIA_COLOR_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="MEDIA_PURPOSE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="MEDIA_CONDITION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LINEAR_MASS_DENSITY_UNIT_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="FIBER_SHAPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="FIBER_SYNTH_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> @@ -3055,7 +3057,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RML"> - <PropertyRef Name="COLOR_GUID" /> + <PropertyRef Name="MEDIA_COLOR_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -3067,7 +3069,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RML"> - <PropertyRef Name="CONDITION_GUID" /> + <PropertyRef Name="MEDIA_CONDITION_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -3079,7 +3081,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RML"> - <PropertyRef Name="MATERIAL_GUID" /> + <PropertyRef Name="MEDIA_MATERIAL_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -3091,7 +3093,7 @@ <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RML"> - <PropertyRef Name="PURPOSE_GUID" /> + <PropertyRef Name="MEDIA_PURPOSE_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -3172,7 +3174,9 @@ </ReferentialConstraint> </Association> <Association Name="FK_USERS_ROLES_USERS"> - <End Type="RemoteModel.USER" Role="USER" Multiplicity="1" /> + <End Type="RemoteModel.USER" Role="USER" Multiplicity="1"> + <OnDelete Action="Cascade" /> + </End> <End Type="RemoteModel.USERS_ROLES" Role="USERS_ROLES" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="USER"> @@ -3733,10 +3737,10 @@ <ScalarProperty Name="FIBER_SYNTH_GUID" ColumnName="FIBER_SYNTH_GUID" /> <ScalarProperty Name="FIBER_SHAPE_GUID" ColumnName="FIBER_SHAPE_GUID" /> <ScalarProperty Name="LINEAR_MASS_DENSITY_UNIT_GUID" ColumnName="LINEAR_MASS_DENSITY_UNIT_GUID" /> - <ScalarProperty Name="CONDITION_GUID" ColumnName="CONDITION_GUID" /> - <ScalarProperty Name="PURPOSE_GUID" ColumnName="PURPOSE_GUID" /> - <ScalarProperty Name="COLOR_GUID" ColumnName="COLOR_GUID" /> - <ScalarProperty Name="MATERIAL_GUID" ColumnName="MATERIAL_GUID" /> + <ScalarProperty Name="MEDIA_CONDITION_GUID" ColumnName="MEDIA_CONDITION_GUID" /> + <ScalarProperty Name="MEDIA_PURPOSE_GUID" ColumnName="MEDIA_PURPOSE_GUID" /> + <ScalarProperty Name="MEDIA_COLOR_GUID" ColumnName="MEDIA_COLOR_GUID" /> + <ScalarProperty Name="MEDIA_MATERIAL_GUID" ColumnName="MEDIA_MATERIAL_GUID" /> <ScalarProperty Name="CODE" ColumnName="CODE" /> <ScalarProperty Name="MANUFACTURER" ColumnName="MANUFACTURER" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> 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 9ff8be4cb..4c973eb66 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,55 +5,55 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="6" PointY="62.375" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="33.75" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="1.5" PointY="60" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="45.375" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="1.5" PointY="48.25" /> - <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="1.5" PointY="57.125" /> - <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="12.75" PointY="10.5" /> - <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="5.75" PointY="5.75" /> - <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="9.125" /> + <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="11" PointY="43.25" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3.5" PointY="57.5" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="3.5" PointY="40" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="37" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="3.5" PointY="48.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="3.5" PointY="54.625" /> + <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="14.75" PointY="11.875" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="5.75" PointY="41" /> + <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="15.125" /> <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="29.25" /> - <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="10.5" PointY="7.625" /> - <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3.75" PointY="52.5" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="38" /> - <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="5.75" PointY="58.75" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="54.125" /> - <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="51.25" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="6" PointY="52.25" /> - <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="8.25" PointY="55.375" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="19.75" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="25.625" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="1.5" PointY="62.875" /> - <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="8" PointY="30" /> - <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="10.5" PointY="14.875" /> - <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="8.25" PointY="12.375" /> - <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="22.75" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="6" /> - <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="13.25" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3.75" PointY="42.125" /> - <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="6" PointY="47.5" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="8.25" PointY="51.5" /> - <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="8.25" PointY="42" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="9.125" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="13.375" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="16.875" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="6.25" /> - <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="5.75" PointY="1.625" /> - <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3.75" PointY="36" /> - <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="9" PointY="46.375" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="19.75" /> - <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="21" /> + <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="12.5" PointY="17" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="5.75" PointY="44.125" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3.5" PointY="61.75" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="5.75" PointY="25.5" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="45.75" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="51.625" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="8" PointY="52.125" /> + <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="13.25" PointY="52.25" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="13.375" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="22.75" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="3.5" PointY="42.875" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="8" PointY="32.875" /> + <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="12.5" PointY="9.625" /> + <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="10.25" PointY="10.375" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="8.875" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="20" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="8.25" PointY="16.25" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.75" PointY="33.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="8" PointY="47.5" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="10.25" PointY="46.625" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="10.25" PointY="49.875" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="6.25" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="25.625" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="19.75" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="16.875" /> + <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="5.75" PointY="37.875" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.75" PointY="59.875" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="8" PointY="64.125" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="9.875" /> + <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="11.125" /> <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="10.625" /> - <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="6" PointY="40.25" /> - <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="11.25" PointY="40.375" /> - <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="10.5" PointY="11.625" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="8" PointY="56" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="10.25" PointY="56.125" /> + <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="12.5" PointY="12.875" /> <EntityTypeShape EntityType="RemoteModel.SENSOR" Width="1.5" PointX="0.75" PointY="0.75" /> <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="2.75" PointY="0.75" /> - <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="6" PointY="35.625" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="8.25" PointY="36.25" /> - <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="6" PointY="16.625" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="8" PointY="59.375" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="10.25" PointY="60" /> + <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="8" PointY="19.625" /> <AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> diff --git a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs index 159fbc930..3435021eb 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs @@ -27,17 +27,17 @@ namespace Tango.UnitTesting [TestMethod] public void Load_Observable_Machines() { - using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false)) - { - List<Machine> machines = db.MACHINES.ToList().Select(x => new Machine(x)).ToList(); + //using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false)) + //{ + // List<Machine> machines = db.MACHINES.ToList().Select(x => new Machine(x)).ToList(); - foreach (var machine in machines) - { - machine.SerialNumber = "1111"; - machine.Organization.Address.AddressString = "HOW HOW HOW"; - machine.Save(); - } - } + // foreach (var machine in machines) + // { + // machine.SerialNumber = "1111"; + // machine.Organization.Address.AddressString = "HOW HOW HOW"; + // machine.Save(); + // } + //} } } } diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index caf47b3b8..ef0522e0a 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Protobuf", "Tango.Protobuf\Tango.Protobuf.csproj", "{40073806-914E-4E78-97AB-FA9639308EBE}" EndProject @@ -975,6 +975,7 @@ Global {8491D07B-C1F6-4B62-A412-41B9FD2D6538}.Release|x86.ActiveCfg = Release|Any CPU {8491D07B-C1F6-4B62-A412-41B9FD2D6538}.Release|x86.Build.0 = Release|Any CPU {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|ARM.ActiveCfg = Debug|Any CPU {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|ARM.Build.0 = Debug|Any CPU {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|ARM64.ActiveCfg = Debug|Any CPU diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs index 33f2d81ff..af0e1a08d 100644 --- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs @@ -35,6 +35,8 @@ namespace Tango.DBObservablesGenerator.CLI TableName = table.Name, }; + List<String> foreignKeys = table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(3).Where(x => x.PropertyType == typeof(String)).Where(x => x.Name.ToLower().Contains("guid")).Select(x => ObservableEntity.DalNameToStandardName(x.Name).SingularizeMVC().Replace("Guid", "")).ToList(); + foreach (var field in table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(3)) { EntityCodeFileField codeField = new EntityCodeFileField(); @@ -50,13 +52,29 @@ namespace Tango.DBObservablesGenerator.CLI } else { - if (field.PropertyType.IsClass && field.PropertyType != typeof(String)) + if (field.PropertyType.IsClass && field.PropertyType != typeof(String) && field.PropertyType != typeof(byte[])) { codeField.Type = ObservableEntity.DalNameToStandardName(field.PropertyType.Name).SingularizeMVC(); + codeField.Name = codeField.Type; + + var fk = foreignKeys.SingleOrDefault(x => x.Contains(codeField.Name)); + + if (fk != null) + { + codeField.Name = fk; + } + + codeField.Complex = true; } else { codeField.Type = field.PropertyType.Name; + + if (codeField.Name.EndsWith("Guid")) + { + codeField.IsForeignKey = true; + codeField.ForeignKeyName = codeField.Name.Replace("Guid",""); + } } } codeFile.Fields.Add(codeField); @@ -131,6 +149,22 @@ namespace Tango.DBObservablesGenerator.CLI String adapterCode = adapterFile.GenerateCode(); File.WriteAllText(Path.Combine(targetPath, "ObservablesEntitiesAdapterExtension.cs"), adapterCode); //Generate Observables Adapter Extensions... + + //Generate Observables Context + ObservablesContextCodeFile contextFile = new ObservablesContextCodeFile(); + contextFile.Name = "ObservablesContext"; + + foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) + { + contextFile.Properties.Add(new Property() + { + Name = ObservableEntity.DalNameToStandardName(table.Name), + Type = String.Format("DbSet<{0}>", ObservableEntity.DalNameToStandardName(table.PropertyType.GenericTypeArguments.Single().Name).SingularizeMVC()), + }); + } + String contextCode = contextFile.GenerateCode(); + File.WriteAllText(Path.Combine(targetPath, "ObservablesContext.cs"), contextCode); + //Generate Observables Context } /// <summary> 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 0693a2623..14d90fcdf 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db +++ b/Software/Visual_Studio/Web/Tango.MachineService/App_Data/Tango.db |
