|
|
|
using BookStore.Entities;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Sanhe.Abp.LocalizationManagement.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.EntityFrameworkCore.Modeling;
|
|
|
|
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.Identity.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.IdentityServer.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore;
|
|
|
|
using Volo.Abp.TenantManagement.EntityFrameworkCore;
|
|
|
|
|
|
|
|
namespace BookStore.Data;
|
|
|
|
|
|
|
|
public class BookStoreDbContext : AbpDbContext<BookStoreDbContext>
|
|
|
|
{
|
|
|
|
public DbSet<Book> Books { get; set; }
|
|
|
|
|
|
|
|
public BookStoreDbContext(DbContextOptions<BookStoreDbContext> options)
|
|
|
|
: base(options)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
|
|
{
|
|
|
|
base.OnModelCreating(builder);
|
|
|
|
|
|
|
|
/* Include modules to your migration db context */
|
|
|
|
|
|
|
|
builder.ConfigurePermissionManagement();
|
|
|
|
builder.ConfigureSettingManagement();
|
|
|
|
builder.ConfigureAuditLogging();
|
|
|
|
builder.ConfigureIdentity();
|
|
|
|
builder.ConfigureIdentityServer();
|
|
|
|
builder.ConfigureFeatureManagement();
|
|
|
|
builder.ConfigureTenantManagement();
|
|
|
|
builder.ConfigureLocalization();
|
|
|
|
|
|
|
|
/* Configure your own entities here */
|
|
|
|
builder.Entity<Book>(b =>
|
|
|
|
{
|
|
|
|
b.ToTable("Books");
|
|
|
|
|
|
|
|
b.Property(p => p.BookName).HasMaxLength(64).IsRequired();
|
|
|
|
b.Property(p => p.Description).HasMaxLength(512);
|
|
|
|
|
|
|
|
b.ConfigureCommentByDisplayName();
|
|
|
|
b.ConfigureByConvention();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|