isn/src/isnd/Data/ApplicationDbContext.cs

32 lines
1,009 B
C#
Raw Normal View History

2021-04-25 12:12:50 +01:00
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Identity;
2021-04-25 12:12:50 +01:00
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
2021-07-05 12:55:52 +01:00
using isn.Data;
using isn.Data.ApiKeys;
2021-04-25 12:12:50 +01:00
2021-07-05 12:55:52 +01:00
namespace isn.Data
2021-04-25 12:12:50 +01:00
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
2021-06-21 23:38:05 +01:00
modelBuilder.Entity<PackageVersion>().HasKey(v => new
{
2021-06-21 23:38:05 +01:00
v.PackageId,
v.FullString,
v.Type
});
}
2021-05-02 16:37:03 +01:00
public DbSet<ApiKey> ApiKeys { get; set; }
2021-05-16 14:07:14 +01:00
public DbSet<Package> Packages { get; set; }
public DbSet<PackageVersion> PackageVersions { get; set; }
2021-04-25 12:12:50 +01:00
}
}