Code cleanup

This commit is contained in:
Robert committed 2019-11-13 19:57:23 +01:00
1 parent 44eaa6ac40
commit 5340e6c6d4
70 files changed
+492 -488

No files matched your search

@@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Artemis.Storage.Entities
{
@@ -7,7 +6,7 @@ namespace Artemis.Storage.Entities
{
public Guid PluginGuid { get; set; }
public string Name { get; set; }
public string Value { get; set; }
}
}
@@ -8,11 +8,11 @@ namespace Artemis.Storage.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Folders",
columns: table => new
"Folders",
table => new
{
Guid = table.Column<string>(nullable: false),
Order = table.Column<int>(nullable: false),
Guid = table.Column<string>(),
Order = table.Column<int>(),
Name = table.Column<string>(nullable: true),
FolderEntityGuid = table.Column<string>(nullable: true)
},
@@ -20,57 +20,48 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Folders", x => x.Guid);
table.ForeignKey(
name: "FK_Folders_Folders_FolderEntityGuid",
column: x => x.FolderEntityGuid,
principalTable: "Folders",
principalColumn: "Guid",
"FK_Folders_Folders_FolderEntityGuid",
x => x.FolderEntityGuid,
"Folders",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "PluginSettings",
columns: table => new
"PluginSettings",
table => new
{
PluginGuid = table.Column<Guid>(nullable: false),
Name = table.Column<string>(nullable: false),
PluginGuid = table.Column<Guid>(),
Name = table.Column<string>(),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PluginSettings", x => new { x.Name, x.PluginGuid });
});
constraints: table => { table.PrimaryKey("PK_PluginSettings", x => new {x.Name, x.PluginGuid}); });
migrationBuilder.CreateTable(
name: "Settings",
columns: table => new
"Settings",
table => new
{
Name = table.Column<string>(nullable: false),
Name = table.Column<string>(),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Settings", x => x.Name);
});
constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); });
migrationBuilder.CreateTable(
name: "Surfaces",
columns: table => new
"Surfaces",
table => new
{
Guid = table.Column<string>(nullable: false),
Guid = table.Column<string>(),
Name = table.Column<string>(nullable: true),
IsActive = table.Column<bool>(nullable: false)
IsActive = table.Column<bool>()
},
constraints: table =>
{
table.PrimaryKey("PK_Surfaces", x => x.Guid);
});
constraints: table => { table.PrimaryKey("PK_Surfaces", x => x.Guid); });
migrationBuilder.CreateTable(
name: "Layers",
columns: table => new
"Layers",
table => new
{
Guid = table.Column<string>(nullable: false),
Order = table.Column<int>(nullable: false),
Guid = table.Column<string>(),
Order = table.Column<int>(),
Name = table.Column<string>(nullable: true),
FolderEntityGuid = table.Column<string>(nullable: true)
},
@@ -78,62 +69,62 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Layers", x => x.Guid);
table.ForeignKey(
name: "FK_Layers_Folders_FolderEntityGuid",
column: x => x.FolderEntityGuid,
principalTable: "Folders",
principalColumn: "Guid",
"FK_Layers_Folders_FolderEntityGuid",
x => x.FolderEntityGuid,
"Folders",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Profiles",
columns: table => new
"Profiles",
table => new
{
Guid = table.Column<string>(nullable: false),
PluginGuid = table.Column<Guid>(nullable: false),
Guid = table.Column<string>(),
PluginGuid = table.Column<Guid>(),
Name = table.Column<string>(nullable: true),
RootFolderId = table.Column<int>(nullable: false),
RootFolderId = table.Column<int>(),
RootFolderGuid = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Profiles", x => x.Guid);
table.ForeignKey(
name: "FK_Profiles_Folders_RootFolderGuid",
column: x => x.RootFolderGuid,
principalTable: "Folders",
principalColumn: "Guid",
"FK_Profiles_Folders_RootFolderGuid",
x => x.RootFolderGuid,
"Folders",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "DeviceEntity",
columns: table => new
"DeviceEntity",
table => new
{
Guid = table.Column<string>(nullable: false),
DeviceHashCode = table.Column<int>(nullable: false),
X = table.Column<double>(nullable: false),
Y = table.Column<double>(nullable: false),
Rotation = table.Column<double>(nullable: false),
ZIndex = table.Column<int>(nullable: false),
Guid = table.Column<string>(),
DeviceHashCode = table.Column<int>(),
X = table.Column<double>(),
Y = table.Column<double>(),
Rotation = table.Column<double>(),
ZIndex = table.Column<int>(),
SurfaceId = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DeviceEntity", x => x.Guid);
table.ForeignKey(
name: "FK_DeviceEntity_Surfaces_SurfaceId",
column: x => x.SurfaceId,
principalTable: "Surfaces",
principalColumn: "Guid",
"FK_DeviceEntity_Surfaces_SurfaceId",
x => x.SurfaceId,
"Surfaces",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "LayerSettings",
columns: table => new
"LayerSettings",
table => new
{
Guid = table.Column<string>(nullable: false),
Guid = table.Column<string>(),
Name = table.Column<string>(nullable: true),
Value = table.Column<string>(nullable: true),
LayerEntityGuid = table.Column<string>(nullable: true)
@@ -142,18 +133,18 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_LayerSettings", x => x.Guid);
table.ForeignKey(
name: "FK_LayerSettings_Layers_LayerEntityGuid",
column: x => x.LayerEntityGuid,
principalTable: "Layers",
principalColumn: "Guid",
"FK_LayerSettings_Layers_LayerEntityGuid",
x => x.LayerEntityGuid,
"Layers",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Leds",
columns: table => new
"Leds",
table => new
{
Guid = table.Column<string>(nullable: false),
Guid = table.Column<string>(),
LedName = table.Column<string>(nullable: true),
LimitedToDevice = table.Column<string>(nullable: true),
LayerId = table.Column<string>(nullable: true)
@@ -162,19 +153,19 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Leds", x => x.Guid);
table.ForeignKey(
name: "FK_Leds_Layers_LayerId",
column: x => x.LayerId,
principalTable: "Layers",
principalColumn: "Guid",
"FK_Leds_Layers_LayerId",
x => x.LayerId,
"Layers",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Keypoints",
columns: table => new
"Keypoints",
table => new
{
Guid = table.Column<string>(nullable: false),
Time = table.Column<int>(nullable: false),
Guid = table.Column<string>(),
Time = table.Column<int>(),
Value = table.Column<string>(nullable: true),
LayerSettingEntityGuid = table.Column<string>(nullable: true)
},
@@ -182,80 +173,80 @@ namespace Artemis.Storage.Migrations
{
table.PrimaryKey("PK_Keypoints", x => x.Guid);
table.ForeignKey(
name: "FK_Keypoints_LayerSettings_LayerSettingEntityGuid",
column: x => x.LayerSettingEntityGuid,
principalTable: "LayerSettings",
principalColumn: "Guid",
"FK_Keypoints_LayerSettings_LayerSettingEntityGuid",
x => x.LayerSettingEntityGuid,
"LayerSettings",
"Guid",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_DeviceEntity_SurfaceId",
table: "DeviceEntity",
column: "SurfaceId");
"IX_DeviceEntity_SurfaceId",
"DeviceEntity",
"SurfaceId");
migrationBuilder.CreateIndex(
name: "IX_Folders_FolderEntityGuid",
table: "Folders",
column: "FolderEntityGuid");
"IX_Folders_FolderEntityGuid",
"Folders",
"FolderEntityGuid");
migrationBuilder.CreateIndex(
name: "IX_Keypoints_LayerSettingEntityGuid",
table: "Keypoints",
column: "LayerSettingEntityGuid");
"IX_Keypoints_LayerSettingEntityGuid",
"Keypoints",
"LayerSettingEntityGuid");
migrationBuilder.CreateIndex(
name: "IX_Layers_FolderEntityGuid",
table: "Layers",
column: "FolderEntityGuid");
"IX_Layers_FolderEntityGuid",
"Layers",
"FolderEntityGuid");
migrationBuilder.CreateIndex(
name: "IX_LayerSettings_LayerEntityGuid",
table: "LayerSettings",
column: "LayerEntityGuid");
"IX_LayerSettings_LayerEntityGuid",
"LayerSettings",
"LayerEntityGuid");
migrationBuilder.CreateIndex(
name: "IX_Leds_LayerId",
table: "Leds",
column: "LayerId");
"IX_Leds_LayerId",
"Leds",
"LayerId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_RootFolderGuid",
table: "Profiles",
column: "RootFolderGuid");
"IX_Profiles_RootFolderGuid",
"Profiles",
"RootFolderGuid");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DeviceEntity");
"DeviceEntity");
migrationBuilder.DropTable(
name: "Keypoints");
"Keypoints");
migrationBuilder.DropTable(
name: "Leds");
"Leds");
migrationBuilder.DropTable(
name: "PluginSettings");
"PluginSettings");
migrationBuilder.DropTable(
name: "Profiles");
"Profiles");
migrationBuilder.DropTable(
name: "Settings");
"Settings");
migrationBuilder.DropTable(
name: "Surfaces");
"Surfaces");
migrationBuilder.DropTable(
name: "LayerSettings");
"LayerSettings");
migrationBuilder.DropTable(
name: "Layers");
"Layers");
migrationBuilder.DropTable(
name: "Folders");
"Folders");
}
}
}
}
@@ -1,14 +1,13 @@
// <auto-generated />
using System;
using Artemis.Storage;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
partial class StorageContextModelSnapshot : ModelSnapshot
internal class StorageContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
@@ -17,227 +16,227 @@ namespace Artemis.Storage.Migrations
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<int>("DeviceHashCode");
b.Property<int>("DeviceHashCode");
b.Property<double>("Rotation");
b.Property<double>("Rotation");
b.Property<string>("SurfaceId");
b.Property<string>("SurfaceId");
b.Property<double>("X");
b.Property<double>("X");
b.Property<double>("Y");
b.Property<double>("Y");
b.Property<int>("ZIndex");
b.Property<int>("ZIndex");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("SurfaceId");
b.HasIndex("SurfaceId");
b.ToTable("DeviceEntity");
});
b.ToTable("DeviceEntity");
});
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("FolderEntityGuid");
b.Property<string>("FolderEntityGuid");
b.Property<string>("Name");
b.Property<string>("Name");
b.Property<int>("Order");
b.Property<int>("Order");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("FolderEntityGuid");
b.HasIndex("FolderEntityGuid");
b.ToTable("Folders");
});
b.ToTable("Folders");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("LayerSettingEntityGuid");
b.Property<string>("LayerSettingEntityGuid");
b.Property<int>("Time");
b.Property<int>("Time");
b.Property<string>("Value");
b.Property<string>("Value");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("LayerSettingEntityGuid");
b.HasIndex("LayerSettingEntityGuid");
b.ToTable("Keypoints");
});
b.ToTable("Keypoints");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("FolderEntityGuid");
b.Property<string>("FolderEntityGuid");
b.Property<string>("Name");
b.Property<string>("Name");
b.Property<int>("Order");
b.Property<int>("Order");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("FolderEntityGuid");
b.HasIndex("FolderEntityGuid");
b.ToTable("Layers");
});
b.ToTable("Layers");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("LayerEntityGuid");
b.Property<string>("LayerEntityGuid");
b.Property<string>("Name");
b.Property<string>("Name");
b.Property<string>("Value");
b.Property<string>("Value");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("LayerEntityGuid");
b.HasIndex("LayerEntityGuid");
b.ToTable("LayerSettings");
});
b.ToTable("LayerSettings");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("LayerId");
b.Property<string>("LayerId");
b.Property<string>("LedName");
b.Property<string>("LedName");
b.Property<string>("LimitedToDevice");
b.Property<string>("LimitedToDevice");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("LayerId");
b.HasIndex("LayerId");
b.ToTable("Leds");
});
b.ToTable("Leds");
});
modelBuilder.Entity("Artemis.Storage.Entities.PluginSettingEntity", b =>
{
b.Property<string>("Name");
{
b.Property<string>("Name");
b.Property<Guid>("PluginGuid");
b.Property<Guid>("PluginGuid");
b.Property<string>("Value");
b.Property<string>("Value");
b.HasKey("Name", "PluginGuid");
b.HasKey("Name", "PluginGuid");
b.ToTable("PluginSettings");
});
b.ToTable("PluginSettings");
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<string>("Name");
b.Property<Guid>("PluginGuid");
b.Property<Guid>("PluginGuid");
b.Property<string>("RootFolderGuid");
b.Property<string>("RootFolderGuid");
b.Property<int>("RootFolderId");
b.Property<int>("RootFolderId");
b.HasKey("Guid");
b.HasKey("Guid");
b.HasIndex("RootFolderGuid");
b.HasIndex("RootFolderGuid");
b.ToTable("Profiles");
});
b.ToTable("Profiles");
});
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
{
b.Property<string>("Name")
.ValueGeneratedOnAdd();
b.Property<string>("Value");
b.Property<string>("Value");
b.HasKey("Name");
b.HasKey("Name");
b.ToTable("Settings");
});
b.ToTable("Settings");
});
modelBuilder.Entity("Artemis.Storage.Entities.SurfaceEntity", b =>
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
{
b.Property<string>("Guid")
.ValueGeneratedOnAdd();
b.Property<bool>("IsActive");
b.Property<bool>("IsActive");
b.Property<string>("Name");
b.Property<string>("Name");
b.HasKey("Guid");
b.HasKey("Guid");
b.ToTable("Surfaces");
});
b.ToTable("Surfaces");
});
modelBuilder.Entity("Artemis.Storage.Entities.DeviceEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
.WithMany("DeviceEntities")
.HasForeignKey("SurfaceId");
});
{
b.HasOne("Artemis.Storage.Entities.SurfaceEntity", "Surface")
.WithMany("DeviceEntities")
.HasForeignKey("SurfaceId");
});
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Folders")
.HasForeignKey("FolderEntityGuid");
});
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Folders")
.HasForeignKey("FolderEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
.WithMany("Keypoints")
.HasForeignKey("LayerSettingEntityGuid");
});
{
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
.WithMany("Keypoints")
.HasForeignKey("LayerSettingEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Layers")
.HasForeignKey("FolderEntityGuid");
});
{
b.HasOne("Artemis.Storage.Entities.FolderEntity")
.WithMany("Layers")
.HasForeignKey("FolderEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity")
.WithMany("Settings")
.HasForeignKey("LayerEntityGuid");
});
{
b.HasOne("Artemis.Storage.Entities.LayerEntity")
.WithMany("Settings")
.HasForeignKey("LayerEntityGuid");
});
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
.WithMany("Leds")
.HasForeignKey("LayerId");
});
{
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
.WithMany("Leds")
.HasForeignKey("LayerId");
});
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
.WithMany()
.HasForeignKey("RootFolderGuid");
});
{
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
.WithMany()
.HasForeignKey("RootFolderGuid");
});
#pragma warning restore 612, 618
}
}
}
}
@@ -46,7 +46,7 @@ namespace Artemis.Storage.Repositories
{
return await _dbContext.Surfaces.Include(s => s.DeviceEntities).ToListAsync();
}
public void Save()
{
_dbContext.SaveChanges();