Add model contraints.

This commit is contained in:
2019-05-19 18:35:28 +01:00
parent 843496bb1c
commit b464d2fb81
16 changed files with 188 additions and 72 deletions

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Cicm.Database.Migrations
{
public partial class DataAnnotations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Text",
table: "CompanyDescriptions",
maxLength: 262144,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 262144,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Text",
table: "CompanyDescriptions",
maxLength: 262144,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 262144);
}
}
}

View File

@@ -24,7 +24,7 @@ namespace Cicm.Database.Migrations
.HasDefaultValueSql("'0'"); .HasDefaultValueSql("'0'");
b.Property<string>("Browser").IsRequired().ValueGeneratedOnAdd().HasColumnName("browser") b.Property<string>("Browser").IsRequired().ValueGeneratedOnAdd().HasColumnName("browser")
.HasColumnType("varchar(64)").HasDefaultValueSql("''"); .HasColumnType("varchar(64)").HasDefaultValueSql("''").HasMaxLength(64);
b.Property<sbyte>("Colors").ValueGeneratedOnAdd().HasColumnName("colors").HasColumnType("tinyint(1)") b.Property<sbyte>("Colors").ValueGeneratedOnAdd().HasColumnName("colors").HasColumnType("tinyint(1)")
.HasDefaultValueSql("'0'"); .HasDefaultValueSql("'0'");
@@ -48,10 +48,10 @@ namespace Cicm.Database.Migrations
.HasDefaultValueSql("'0'"); .HasDefaultValueSql("'0'");
b.Property<string>("Os").IsRequired().ValueGeneratedOnAdd().HasColumnName("os") b.Property<string>("Os").IsRequired().ValueGeneratedOnAdd().HasColumnName("os")
.HasColumnType("varchar(32)").HasDefaultValueSql("''"); .HasColumnType("varchar(32)").HasDefaultValueSql("''").HasMaxLength(32);
b.Property<string>("Platform").IsRequired().ValueGeneratedOnAdd().HasColumnName("platform") b.Property<string>("Platform").IsRequired().ValueGeneratedOnAdd().HasColumnName("platform")
.HasColumnType("varchar(8)").HasDefaultValueSql("''"); .HasColumnType("varchar(8)").HasDefaultValueSql("''").HasMaxLength(8);
b.Property<sbyte>("Png").ValueGeneratedOnAdd().HasColumnName("png").HasColumnType("tinyint(1)") b.Property<sbyte>("Png").ValueGeneratedOnAdd().HasColumnName("png").HasColumnType("tinyint(1)")
.HasDefaultValueSql("'0'"); .HasDefaultValueSql("'0'");
@@ -63,10 +63,10 @@ namespace Cicm.Database.Migrations
.HasDefaultValueSql("'0'"); .HasDefaultValueSql("'0'");
b.Property<string>("UserAgent").IsRequired().ValueGeneratedOnAdd().HasColumnName("user_agent") b.Property<string>("UserAgent").IsRequired().ValueGeneratedOnAdd().HasColumnName("user_agent")
.HasColumnType("varchar(128)").HasDefaultValueSql("''"); .HasColumnType("varchar(128)").HasDefaultValueSql("''").HasMaxLength(128);
b.Property<string>("Version").IsRequired().ValueGeneratedOnAdd().HasColumnName("version") b.Property<string>("Version").IsRequired().ValueGeneratedOnAdd().HasColumnName("version")
.HasColumnType("varchar(16)").HasDefaultValueSql("''"); .HasColumnType("varchar(16)").HasDefaultValueSql("''").HasMaxLength(16);
b.HasKey("Id"); b.HasKey("Id");
@@ -101,22 +101,23 @@ namespace Cicm.Database.Migrations
{ {
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)"); b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
b.Property<string>("Address").HasColumnName("address").HasColumnType("varchar(80)"); b.Property<string>("Address").HasColumnName("address").HasColumnType("varchar(80)").HasMaxLength(80);
b.Property<string>("City").HasColumnName("city").HasColumnType("varchar(80)"); b.Property<string>("City").HasColumnName("city").HasColumnType("varchar(80)").HasMaxLength(80);
b.Property<short?>("CountryId").HasColumnName("country").HasColumnType("smallint(3)"); b.Property<short?>("CountryId").HasColumnName("country").HasColumnType("smallint(3)");
b.Property<string>("Facebook").HasColumnName("facebook").HasColumnType("varchar(45)"); b.Property<string>("Facebook").HasColumnName("facebook").HasColumnType("varchar(45)").HasMaxLength(45);
b.Property<DateTime?>("Founded").HasColumnName("founded").HasColumnType("datetime"); b.Property<DateTime?>("Founded").HasColumnName("founded").HasColumnType("datetime");
b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name") b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name")
.HasColumnType("varchar(128)").HasDefaultValueSql("''"); .HasColumnType("varchar(128)").HasDefaultValueSql("''");
b.Property<string>("PostalCode").HasColumnName("postal_code").HasColumnType("varchar(25)"); b.Property<string>("PostalCode").HasColumnName("postal_code").HasColumnType("varchar(25)")
.HasMaxLength(25);
b.Property<string>("Province").HasColumnName("province").HasColumnType("varchar(80)"); b.Property<string>("Province").HasColumnName("province").HasColumnType("varchar(80)").HasMaxLength(80);
b.Property<DateTime?>("Sold").HasColumnName("sold").HasColumnType("datetime"); b.Property<DateTime?>("Sold").HasColumnName("sold").HasColumnType("datetime");
@@ -124,9 +125,9 @@ namespace Cicm.Database.Migrations
b.Property<int>("Status").HasColumnName("status").HasColumnType("int(11)"); b.Property<int>("Status").HasColumnName("status").HasColumnType("int(11)");
b.Property<string>("Twitter").HasColumnName("twitter").HasColumnType("varchar(45)"); b.Property<string>("Twitter").HasColumnName("twitter").HasColumnType("varchar(45)").HasMaxLength(45);
b.Property<string>("Website").HasColumnName("website").HasColumnType("varchar(255)"); b.Property<string>("Website").HasColumnName("website").HasColumnType("varchar(255)").HasMaxLength(255);
b.HasKey("Id"); b.HasKey("Id");
@@ -167,7 +168,7 @@ namespace Cicm.Database.Migrations
b.Property<string>("Html").HasMaxLength(262144); b.Property<string>("Html").HasMaxLength(262144);
b.Property<string>("Text").HasMaxLength(262144); b.Property<string>("Text").IsRequired().HasMaxLength(262144);
b.HasKey("Id"); b.HasKey("Id");
@@ -238,14 +239,15 @@ namespace Cicm.Database.Migrations
b.Property<DateTime?>("Introduced").HasColumnName("introduced").HasColumnType("datetime"); b.Property<DateTime?>("Introduced").HasColumnName("introduced").HasColumnType("datetime");
b.Property<string>("ModelCode").HasColumnName("model_code").HasColumnType("varchar(45)"); b.Property<string>("ModelCode").HasColumnName("model_code").HasColumnType("varchar(45)")
.HasMaxLength(45);
b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name") b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name")
.HasColumnType("char(128)").HasDefaultValueSql("''"); .HasColumnType("char(128)").HasDefaultValueSql("''").HasMaxLength(128);
b.Property<string>("Package").HasColumnName("package").HasColumnType("varchar(45)"); b.Property<string>("Package").HasColumnName("package").HasColumnType("varchar(45)").HasMaxLength(45);
b.Property<string>("Process").HasColumnName("process").HasColumnType("varchar(45)"); b.Property<string>("Process").HasColumnName("process").HasColumnType("varchar(45)").HasMaxLength(45);
b.Property<float?>("ProcessNm").HasColumnName("process_nm"); b.Property<float?>("ProcessNm").HasColumnName("process_nm");
@@ -295,7 +297,8 @@ namespace Cicm.Database.Migrations
{ {
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)"); b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
b.Property<string>("Name").IsRequired().HasColumnName("instruction_set").HasColumnType("varchar(45)"); b.Property<string>("Name").IsRequired().HasColumnName("instruction_set").HasColumnType("varchar(45)")
.HasMaxLength(45);
b.HasKey("Id"); b.HasKey("Id");
@@ -306,7 +309,8 @@ namespace Cicm.Database.Migrations
{ {
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)"); b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("int(11)");
b.Property<string>("Extension").IsRequired().HasColumnName("extension").HasColumnType("varchar(45)"); b.Property<string>("Extension").IsRequired().HasColumnName("extension").HasColumnType("varchar(45)")
.HasMaxLength(45);
b.HasKey("Id"); b.HasKey("Id");
@@ -334,7 +338,8 @@ namespace Cicm.Database.Migrations
{ {
b.Property<short>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("smallint(3)"); b.Property<short>("Id").ValueGeneratedOnAdd().HasColumnName("id").HasColumnType("smallint(3)");
b.Property<string>("Name").IsRequired().HasColumnName("name").HasColumnType("varchar(64)"); b.Property<string>("Name").IsRequired().HasColumnName("name").HasColumnType("varchar(64)")
.HasMaxLength(64);
b.HasKey("Id"); b.HasKey("Id");
@@ -383,9 +388,10 @@ namespace Cicm.Database.Migrations
b.Property<DateTime?>("Introduced").HasColumnName("introduced").HasColumnType("datetime"); b.Property<DateTime?>("Introduced").HasColumnName("introduced").HasColumnType("datetime");
b.Property<string>("Model").HasColumnName("model").HasColumnType("varchar(50)"); b.Property<string>("Model").HasColumnName("model").HasColumnType("varchar(50)").HasMaxLength(50);
b.Property<string>("Name").IsRequired().HasColumnName("name").HasColumnType("varchar(255)"); b.Property<string>("Name").IsRequired().HasColumnName("name").HasColumnType("varchar(255)")
.HasMaxLength(255);
b.Property<int>("Type").ValueGeneratedOnAdd().HasColumnName("type").HasColumnType("int(11)") b.Property<int>("Type").ValueGeneratedOnAdd().HasColumnName("type").HasColumnType("int(11)")
.HasDefaultValueSql("'0'"); .HasDefaultValueSql("'0'");
@@ -413,7 +419,8 @@ namespace Cicm.Database.Migrations
b.Property<int>("CompanyId").HasColumnName("company").HasColumnType("int(11)"); b.Property<int>("CompanyId").HasColumnName("company").HasColumnType("int(11)");
b.Property<string>("Name").IsRequired().HasColumnName("name").HasColumnType("varchar(255)"); b.Property<string>("Name").IsRequired().HasColumnName("name").HasColumnType("varchar(255)")
.HasMaxLength(255);
b.HasKey("Id"); b.HasKey("Id");
@@ -664,14 +671,15 @@ namespace Cicm.Database.Migrations
b.Property<float?>("L3"); b.Property<float?>("L3");
b.Property<string>("ModelCode").HasColumnName("model_code").HasColumnType("varchar(45)"); b.Property<string>("ModelCode").HasColumnName("model_code").HasColumnType("varchar(45)")
.HasMaxLength(45);
b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name") b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name")
.HasColumnType("char(50)").HasDefaultValueSql("''"); .HasColumnType("char(50)").HasDefaultValueSql("''").HasMaxLength(50);
b.Property<string>("Package").HasColumnName("package").HasColumnType("varchar(45)"); b.Property<string>("Package").HasColumnName("package").HasColumnType("varchar(45)").HasMaxLength(45);
b.Property<string>("Process").HasColumnName("process").HasColumnType("varchar(45)"); b.Property<string>("Process").HasColumnName("process").HasColumnType("varchar(45)").HasMaxLength(45);
b.Property<float?>("ProcessNm").HasColumnName("process_nm"); b.Property<float?>("ProcessNm").HasColumnName("process_nm");
@@ -846,10 +854,11 @@ namespace Cicm.Database.Migrations
b.Property<DateTime?>("Introduced").HasColumnName("introduced").HasColumnType("datetime"); b.Property<DateTime?>("Introduced").HasColumnName("introduced").HasColumnType("datetime");
b.Property<string>("ModelCode").HasColumnName("model_code").HasColumnType("varchar(45)"); b.Property<string>("ModelCode").HasColumnName("model_code").HasColumnType("varchar(45)")
.HasMaxLength(45);
b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name") b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name")
.HasColumnType("char(50)").HasDefaultValueSql("''"); .HasColumnType("char(50)").HasDefaultValueSql("''").HasMaxLength(50);
b.Property<int?>("SquareWave").HasColumnName("square_wave").HasColumnType("int(11)"); b.Property<int?>("SquareWave").HasColumnName("square_wave").HasColumnType("int(11)");

View File

@@ -29,17 +29,28 @@
*******************************************************************************/ *******************************************************************************/
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
public class BrowserTest : BaseModel<int> public class BrowserTest : BaseModel<int>
{ {
[DisplayName("User agent")] [DisplayName("User agent")]
[Required]
[StringLength(128)]
public string UserAgent { get; set; } public string UserAgent { get; set; }
[Required]
[StringLength(64)]
public string Browser { get; set; } public string Browser { get; set; }
[Required]
[StringLength(16)]
public string Version { get; set; } public string Version { get; set; }
[DisplayName("Operating system")] [DisplayName("Operating system")]
[Required]
[StringLength(32)]
public string Os { get; set; } public string Os { get; set; }
[Required]
[StringLength(8)]
public string Platform { get; set; } public string Platform { get; set; }
[DisplayName("GIF87")] [DisplayName("GIF87")]
public bool Gif87 { get; set; } public bool Gif87 { get; set; }

View File

@@ -50,19 +50,30 @@ namespace Cicm.Database.Models
SoundSynths = new HashSet<SoundSynth>(); SoundSynths = new HashSet<SoundSynth>();
} }
[Required]
public string Name { get; set; } public string Name { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")] [DisplayFormat(DataFormatString = "{0:d}")]
public DateTime? Founded { get; set; } public DateTime? Founded { get; set; }
[Url]
[StringLength(255)]
public string Website { get; set; } public string Website { get; set; }
[StringLength(45)]
public string Twitter { get; set; } public string Twitter { get; set; }
[StringLength(45)]
public string Facebook { get; set; } public string Facebook { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
public DateTime? Sold { get; set; } public DateTime? Sold { get; set; }
public int? SoldToId { get; set; } public int? SoldToId { get; set; }
[StringLength(80)]
public string Address { get; set; } public string Address { get; set; }
[StringLength(80)]
public string City { get; set; } public string City { get; set; }
[StringLength(80)]
public string Province { get; set; } public string Province { get; set; }
[StringLength(25)]
public string PostalCode { get; set; } public string PostalCode { get; set; }
public short? CountryId { get; set; } public short? CountryId { get; set; }
[Required]
public CompanyStatus Status { get; set; } public CompanyStatus Status { get; set; }
public virtual Iso31661Numeric Country { get; set; } public virtual Iso31661Numeric Country { get; set; }

View File

@@ -37,6 +37,7 @@ namespace Cicm.Database.Models
{ {
public int CompanyId { get; set; } public int CompanyId { get; set; }
[MaxLength(262144, ErrorMessage = "Description is too long")] [MaxLength(262144, ErrorMessage = "Description is too long")]
[Required]
public string Text { get; set; } public string Text { get; set; }
[MaxLength(262144, ErrorMessage = "Description is too long")] [MaxLength(262144, ErrorMessage = "Description is too long")]
[DisplayName("HTML")] [DisplayName("HTML")]

View File

@@ -32,6 +32,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models namespace Cicm.Database.Models
@@ -44,17 +45,24 @@ namespace Cicm.Database.Models
ResolutionsByGpu = new HashSet<ResolutionsByGpu>(); ResolutionsByGpu = new HashSet<ResolutionsByGpu>();
} }
[Required]
[StringLength(128)]
public string Name { get; set; } public string Name { get; set; }
public int? CompanyId { get; set; } public int? CompanyId { get; set; }
[DisplayName("Model code")] [DisplayName("Model code")]
[StringLength(45)]
public string ModelCode { get; set; } public string ModelCode { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
[StringLength(45)]
public string Package { get; set; } public string Package { get; set; }
[StringLength(45)]
public string Process { get; set; } public string Process { get; set; }
[DisplayName("Process (nm)")] [DisplayName("Process (nm)")]
public float? ProcessNm { get; set; } public float? ProcessNm { get; set; }
[DisplayName("Die size (mm²)")] [DisplayName("Die size (mm²)")]
public float? DieSize { get; set; } public float? DieSize { get; set; }
[Range(1, long.MaxValue)]
public long? Transistors { get; set; } public long? Transistors { get; set; }
public virtual Company Company { get; set; } public virtual Company Company { get; set; }

View File

@@ -29,6 +29,7 @@
*******************************************************************************/ *******************************************************************************/
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -39,6 +40,8 @@ namespace Cicm.Database.Models
Processors = new HashSet<Processor>(); Processors = new HashSet<Processor>();
} }
[Required]
[StringLength(45)]
public string Name { get; set; } public string Name { get; set; }
public virtual ICollection<Processor> Processors { get; set; } public virtual ICollection<Processor> Processors { get; set; }

View File

@@ -30,6 +30,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -41,6 +42,8 @@ namespace Cicm.Database.Models
} }
[DisplayName("Name")] [DisplayName("Name")]
[Required]
[StringLength(45)]
public string Extension { get; set; } public string Extension { get; set; }
public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensionsByProcessor public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensionsByProcessor

View File

@@ -29,6 +29,7 @@
*******************************************************************************/ *******************************************************************************/
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -39,7 +40,10 @@ namespace Cicm.Database.Models
Companies = new HashSet<Company>(); Companies = new HashSet<Company>();
} }
[Required]
public short Id { get; set; } public short Id { get; set; }
[Required]
[StringLength(64)]
public string Name { get; set; } public string Name { get; set; }
public virtual ICollection<Company> Companies { get; set; } public virtual ICollection<Company> Companies { get; set; }

View File

@@ -31,6 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models namespace Cicm.Database.Models
@@ -46,11 +47,17 @@ namespace Cicm.Database.Models
Storage = new HashSet<StorageByMachine>(); Storage = new HashSet<StorageByMachine>();
} }
[Required]
public int CompanyId { get; set; } public int CompanyId { get; set; }
[Required]
[StringLength(255)]
public string Name { get; set; } public string Name { get; set; }
[Required]
public MachineType Type { get; set; } public MachineType Type { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
public int? FamilyId { get; set; } public int? FamilyId { get; set; }
[StringLength(50)]
public string Model { get; set; } public string Model { get; set; }
public virtual Company Company { get; set; } public virtual Company Company { get; set; }

View File

@@ -29,6 +29,7 @@
*******************************************************************************/ *******************************************************************************/
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -40,6 +41,8 @@ namespace Cicm.Database.Models
} }
public int CompanyId { get; set; } public int CompanyId { get; set; }
[Required]
[StringLength(255)]
public string Name { get; set; } public string Name { get; set; }
public virtual Company Company { get; set; } public virtual Company Company { get; set; }

View File

@@ -32,6 +32,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models namespace Cicm.Database.Models
@@ -44,15 +45,20 @@ namespace Cicm.Database.Models
ProcessorsByMachine = new HashSet<ProcessorsByMachine>(); ProcessorsByMachine = new HashSet<ProcessorsByMachine>();
} }
[Required]
[StringLength(50)]
public string Name { get; set; } public string Name { get; set; }
public int? CompanyId { get; set; } public int? CompanyId { get; set; }
[DisplayName("Model code")] [DisplayName("Model code")]
[StringLength(45)]
public string ModelCode { get; set; } public string ModelCode { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
[DisplayName("Instruction set")] [DisplayName("Instruction set")]
public int? InstructionSetId { get; set; } public int? InstructionSetId { get; set; }
[DisplayName("Nominal speed (MHz)")] [DisplayName("Nominal speed (MHz)")]
public double? Speed { get; set; } public double? Speed { get; set; }
[StringLength(45)]
public string Package { get; set; } public string Package { get; set; }
[DisplayName("General Purpose Registers")] [DisplayName("General Purpose Registers")]
public int? Gprs { get; set; } public int? Gprs { get; set; }
@@ -65,6 +71,7 @@ namespace Cicm.Database.Models
public int? Cores { get; set; } public int? Cores { get; set; }
[DisplayName("Threads per core")] [DisplayName("Threads per core")]
public int? ThreadsPerCore { get; set; } public int? ThreadsPerCore { get; set; }
[StringLength(45)]
public string Process { get; set; } public string Process { get; set; }
[DisplayName("Process (nm)")] [DisplayName("Process (nm)")]
public float? ProcessNm { get; set; } public float? ProcessNm { get; set; }

View File

@@ -30,6 +30,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -40,9 +41,15 @@ namespace Cicm.Database.Models
ResolutionsByGpu = new HashSet<ResolutionsByGpu>(); ResolutionsByGpu = new HashSet<ResolutionsByGpu>();
} }
[Required]
[Range(1, 131072)]
public int Width { get; set; } public int Width { get; set; }
[Required]
[Range(1, 131072)]
public int Height { get; set; } public int Height { get; set; }
[Range(2, 281474976710656)]
public long? Colors { get; set; } public long? Colors { get; set; }
[Range(2, 281474976710656)]
public long? Palette { get; set; } public long? Palette { get; set; }
[DisplayName("Character based")] [DisplayName("Character based")]
public bool Chars { get; set; } public bool Chars { get; set; }

View File

@@ -31,6 +31,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models namespace Cicm.Database.Models
@@ -42,20 +43,28 @@ namespace Cicm.Database.Models
SoundByMachine = new HashSet<SoundByMachine>(); SoundByMachine = new HashSet<SoundByMachine>();
} }
[Required]
[StringLength(50)]
public string Name { get; set; } public string Name { get; set; }
public int? CompanyId { get; set; } public int? CompanyId { get; set; }
[DisplayName("Model code")] [DisplayName("Model code")]
[StringLength(45)]
public string ModelCode { get; set; } public string ModelCode { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
[DisplayName("PCM voices")] [DisplayName("PCM voices")]
[Range(1, int.MaxValue)]
public int? Voices { get; set; } public int? Voices { get; set; }
[DisplayName("Sample rate (Hz)")] [DisplayName("Sample rate (Hz)")]
public double? Frequency { get; set; } public double? Frequency { get; set; }
[DisplayName("Sample resolution")] [DisplayName("Sample resolution")]
[Range(1, int.MaxValue)]
public int? Depth { get; set; } public int? Depth { get; set; }
[DisplayName("Square wave channels")] [DisplayName("Square wave channels")]
[Range(1, int.MaxValue)]
public int? SquareWave { get; set; } public int? SquareWave { get; set; }
[DisplayName("White noise channels")] [DisplayName("White noise channels")]
[Range(1, int.MaxValue)]
public int? WhiteNoise { get; set; } public int? WhiteNoise { get; set; }
public int? Type { get; set; } public int? Type { get; set; }

View File

@@ -28,6 +28,8 @@
// Copyright © 2003-2018 Natalia Portillo // Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
public class StorageByMachine : BaseModel<long> public class StorageByMachine : BaseModel<long>
@@ -35,6 +37,7 @@ namespace Cicm.Database.Models
public int MachineId { get; set; } public int MachineId { get; set; }
public StorageType Type { get; set; } public StorageType Type { get; set; }
public StorageInterface Interface { get; set; } public StorageInterface Interface { get; set; }
[Range(1, long.MaxValue)]
public long? Capacity { get; set; } public long? Capacity { get; set; }
public virtual Machine Machine { get; set; } public virtual Machine Machine { get; set; }

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.492</Version> <Version>3.0.99.496</Version>
<Company>Canary Islands Computer Museum</Company> <Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright> <Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product> <Product>Canary Islands Computer Museum Website</Product>