You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
766 B
32 lines
766 B
using Infrastructure.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Infrastructure;
|
|
|
|
public class OptifitDbContext : DbContext
|
|
{
|
|
public virtual DbSet<User> Users { get; set; }
|
|
public OptifitDbContext()
|
|
{
|
|
}
|
|
|
|
public OptifitDbContext(DbContextOptions<OptifitDbContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
|
{
|
|
if (!options.IsConfigured)
|
|
{
|
|
options.UseSqlite("Data Source=InMemoryDb.db");
|
|
}
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<User>().Property(a => a.Name).IsRequired();
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
} |