AuthorizationServerDemos/CSharp/TrafficPoliceApi/Data/ApplicationDbContext.cs
2021-01-18 23:58:49 +03:00

38 lines
913 B
C#

using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace OidcSamples.TrafficPoliceApi.Data
{
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
}
public DbSet<Vehicle> Vehicles { get; set; }
}
public enum VehicleType
{
Sedan = 1,
SUV = 2,
Pickup = 3
}
public class Vehicle
{
public long Id { get; set; }
[StringLength(100)]
public string OwnerId { get; set; }
[StringLength(100)]
public string Model { get; set; }
[StringLength(32)]
public string Color { get; set; }
[StringLength(32)]
public string LicensePlate { get; set; }
public VehicleType Type { get; set; }
}
}