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

37 lines
1.2 KiB
C#
Raw Normal View History

2020-02-17 08:58:14 +00:00
using ASC.Common;
using ASC.Core.Common.EF.Model;
2019-12-06 16:01:12 +00:00
2019-12-04 09:04:32 +00:00
using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Context
{
2020-08-21 02:34:37 +00:00
public partial class WebstudioDbContext : BaseDbContext
2019-12-04 09:04:32 +00:00
{
public DbSet<DbWebstudioSettings> WebstudioSettings { get; set; }
2019-12-06 16:01:12 +00:00
public DbSet<DbWebstudioUserVisit> WebstudioUserVisit { get; set; }
2020-01-24 13:07:51 +00:00
public DbSet<DbWebstudioIndex> WebstudioIndex { get; set; }
2019-12-04 09:04:32 +00:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
2020-09-06 22:49:03 +00:00
ModelBuilderWrapper
.From(modelBuilder, Provider)
.AddWebstudioSettings()
.AddWebstudioUserVisit()
.AddDbWebstudioIndex()
.Finish();
2020-09-18 17:50:30 +00:00
modelBuilder.WebstudioSettingsData();
2020-08-21 02:34:37 +00:00
OnModelCreatingPartial(modelBuilder);
2019-12-04 09:04:32 +00:00
}
2020-08-21 02:34:37 +00:00
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
2019-12-04 09:04:32 +00:00
}
public static class WebstudioDbExtension
{
2020-02-17 08:58:14 +00:00
public static DIHelper AddWebstudioDbContextService(this DIHelper services)
2019-12-04 09:04:32 +00:00
{
2019-12-10 15:06:51 +00:00
return services.AddDbContextManagerService<WebstudioDbContext>();
2019-12-04 09:04:32 +00:00
}
}
}