Add project files.
This commit is contained in:
18
Database/ConnectionsContext.cs
Normal file
18
Database/ConnectionsContext.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using ConnectionsAPI.Database.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ConnectionsAPI.Database
|
||||
{
|
||||
public class ConnectionsContext(DbContextOptions<ConnectionsContext> dbContextOptions) : DbContext(dbContextOptions)
|
||||
{
|
||||
public DbSet<Puzzle> Puzzles { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Puzzle>()
|
||||
.HasIndex(x => x.PrintDate).IsUnique();
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user