isn/src/isnd/Data/ApplicationDbContext.cs
Paul Schneider 476d35ae8a refact
2021-07-05 12:55:52 +01:00

32 lines
1,009 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using isn.Data;
using isn.Data.ApiKeys;
namespace isn.Data
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<PackageVersion>().HasKey(v => new
{
v.PackageId,
v.FullString,
v.Type
});
}
public DbSet<ApiKey> ApiKeys { get; set; }
public DbSet<Package> Packages { get; set; }
public DbSet<PackageVersion> PackageVersions { get; set; }
}
}