SunJian/WebApi/Data/DictionaryDbContext.cs

37 lines
892 B
C#

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using WebApi.Models;
namespace WebApi.Data;
public partial class DictionaryDbContext : DbContext
{
public DictionaryDbContext()
{
}
public DictionaryDbContext(DbContextOptions<DictionaryDbContext> options)
: base(options)
{
}
public virtual DbSet<Dict> Dicts { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlite("Name=ConnectionStrings:Dictionary");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Dict>(entity =>
{
entity.Property(e => e.Word).UseCollation("NOCASE");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}