refact
This commit is contained in:
32
src/isnd/Data/ApplicationDbContext.cs
Normal file
32
src/isnd/Data/ApplicationDbContext.cs
Normal file
@ -0,0 +1,32 @@
|
||||
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; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user