34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using ASC.Core.Common.EF.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace ASC.Core.Common.EF.Context
|
|
{
|
|
public class MessagesContext : BaseDbContext
|
|
{
|
|
public DbSet<AuditEvent> AuditEvents { get; set; }
|
|
public DbSet<LoginEvents> LoginEvents { get; set; }
|
|
public DbSet<DbTenant> Tenants { get; set; }
|
|
public DbSet<DbWebstudioSettings> WebstudioSettings { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.AddWebstudioSettings();
|
|
}
|
|
}
|
|
|
|
public static class MessagesContextExtension
|
|
{
|
|
public static IServiceCollection AddMessagesContextService(this IServiceCollection services)
|
|
{
|
|
services.TryAddScoped<DbContextManager<MessagesContext>>();
|
|
services.TryAddScoped<IConfigureOptions<MessagesContext>, ConfigureDbContext>();
|
|
services.TryAddScoped<MessagesContext>();
|
|
|
|
return services;
|
|
}
|
|
}
|
|
}
|