Add NameCountModel.

This commit is contained in:
2019-12-07 18:38:11 +00:00
parent c579fdb491
commit 58a589bb27
12 changed files with 1555 additions and 42 deletions

View File

@@ -372,6 +372,8 @@
<e p="20191103000828_MakeFieldsUnsigned.cs" t="Include" />
<e p="20191207175444_SyncWithServerChanges.Designer.cs" t="Include" />
<e p="20191207175444_SyncWithServerChanges.cs" t="Include" />
<e p="20191207183522_AddNameCountModel.Designer.cs" t="Include" />
<e p="20191207183522_AddNameCountModel.cs" t="Include" />
<e p="DicContextModelSnapshot.cs" t="Include" />
</e>
<e p="Models" t="Include">
@@ -384,6 +386,7 @@
<e p="Filter.cs" t="Include" />
<e p="Media.cs" t="Include" />
<e p="MediaFormat.cs" t="Include" />
<e p="NameCountModel.cs" t="Include" />
<e p="OperatingSystem.cs" t="Include" />
<e p="Partition.cs" t="Include" />
<e p="Report.cs" t="Include" />

View File

@@ -103,6 +103,8 @@
<Compile Include="Migrations\20191103000828_MakeFieldsUnsigned.Designer.cs" />
<Compile Include="Migrations\20191207175444_SyncWithServerChanges.cs" />
<Compile Include="Migrations\20191207175444_SyncWithServerChanges.Designer.cs" />
<Compile Include="Migrations\20191207183522_AddNameCountModel.cs" />
<Compile Include="Migrations\20191207183522_AddNameCountModel.Designer.cs" />
<Compile Include="Migrations\DicContextModelSnapshot.cs" />
<Compile Include="Models\BaseModel.cs" />
<Compile Include="Models\CdOffset.cs" />
@@ -113,6 +115,7 @@
<Compile Include="Models\Filter.cs" />
<Compile Include="Models\Media.cs" />
<Compile Include="Models\MediaFormat.cs" />
<Compile Include="Models\NameCountModel.cs" />
<Compile Include="Models\OperatingSystem.cs" />
<Compile Include="Models\Partition.cs" />
<Compile Include="Models\Report.cs" />

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace DiscImageChef.Database.Migrations
{
public partial class AddNameCountModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Value",
table: "Versions",
newName: "Name");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Name",
table: "Versions",
newName: "Value");
}
}
}

View File

@@ -1271,9 +1271,9 @@ namespace DiscImageChef.Database.Migrations
b.Property<ulong>("Count");
b.Property<bool>("Synchronized");
b.Property<string>("Name");
b.Property<string>("Value");
b.Property<bool>("Synchronized");
b.HasKey("Id");

View File

@@ -32,10 +32,5 @@
namespace DiscImageChef.Database.Models
{
public class Command : BaseModel<int>
{
public string Name { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
public class Command : NameCountModel<int> { }
}

View File

@@ -32,10 +32,5 @@
namespace DiscImageChef.Database.Models
{
public class Filesystem : BaseModel<int>
{
public string Name { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
public class Filesystem : NameCountModel<int> { }
}

View File

@@ -32,10 +32,5 @@
namespace DiscImageChef.Database.Models
{
public class Filter : BaseModel<int>
{
public string Name { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
public class Filter : NameCountModel<int> { }
}

View File

@@ -32,10 +32,5 @@
namespace DiscImageChef.Database.Models
{
public class MediaFormat : BaseModel<int>
{
public string Name { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
public class MediaFormat : NameCountModel<int> { }
}

View File

@@ -0,0 +1,9 @@
namespace DiscImageChef.Database.Models
{
public abstract class NameCountModel<T> : BaseModel<T>
{
public string Name { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
}

View File

@@ -32,10 +32,5 @@
namespace DiscImageChef.Database.Models
{
public class Partition : BaseModel<int>
{
public string Name { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
public class Partition : NameCountModel<int> { }
}

View File

@@ -30,16 +30,7 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Database.Models
{
public class Version
{
[Key]
public int Id { get; set; }
public string Value { get; set; }
public bool Synchronized { get; set; }
public ulong Count { get; set; }
}
public class Version : NameCountModel<int> { }
}