DocSpace-client/common/ASC.Core.Common/EF/Context/FeedDbContext.cs

35 lines
1.1 KiB
C#
Raw Normal View History

2019-12-09 11:59:22 +00:00
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 FeedDbContext : BaseDbContext
{
public DbSet<FeedLast> FeedLast { get; set; }
public DbSet<FeedAggregate> FeedAggregates { get; set; }
public DbSet<FeedUsers> FeedUsers { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.AddFeedUsers();
}
}
public static class FeedDbExtension
{
public static IServiceCollection AddFeedDbService(this IServiceCollection services)
{
services.TryAddScoped<DbContextManager<FeedDbContext>>();
services.TryAddScoped<IConfigureOptions<FeedDbContext>, ConfigureDbContext>();
services.TryAddScoped<FeedDbContext>();
return services;
}
}
}