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

51 lines
1.6 KiB
C#
Raw Normal View History

2019-12-17 13:01:59 +00:00

2020-02-17 08:58:14 +00:00
using ASC.Common;
2020-09-06 22:49:03 +00:00
using ASC.Core.Common.EF.Model;
2019-12-17 13:01:59 +00:00
using Microsoft.EntityFrameworkCore;
2020-10-06 11:38:15 +00:00
using System;
using System.Collections.Generic;
2019-11-29 12:26:53 +00:00
namespace ASC.Core.Common.EF
{
2020-10-06 11:38:15 +00:00
public class MySqlCoreDbContext : CoreDbContext { }
public class PostgreSqlCoreDbContext : CoreDbContext { }
2019-11-29 12:26:53 +00:00
public class CoreDbContext : BaseDbContext
{
2019-12-02 12:22:40 +00:00
public DbSet<DbTariff> Tariffs { get; set; }
public DbSet<DbButton> Buttons { get; set; }
2019-11-29 13:47:05 +00:00
public DbSet<Acl> Acl { get; set; }
2019-12-02 09:12:16 +00:00
public DbSet<DbQuota> Quotas { get; set; }
public DbSet<DbQuotaRow> QuotaRows { get; set; }
2020-10-06 11:38:15 +00:00
protected override Dictionary<Provider, Func<BaseDbContext>> ProviderContext
2019-12-17 08:27:38 +00:00
{
2020-10-06 11:38:15 +00:00
get
{
return new Dictionary<Provider, Func<BaseDbContext>>()
{
{ Provider.MySql, () => new MySqlCoreDbContext() } ,
2020-10-08 09:07:05 +00:00
{ Provider.Postgre, () => new PostgreSqlCoreDbContext() } ,
2020-10-06 11:38:15 +00:00
};
Merge branch 'master' into feature/fix-messages # Conflicts: # common/ASC.Core.Common/Billing/TariffService.cs # common/ASC.Core.Common/EF/Context/BaseDbContext.cs # common/ASC.Core.Common/EF/Context/CoreDbContext.cs # common/ASC.Core.Common/EF/Context/DbContext.cs # common/ASC.Core.Common/EF/Context/DbContextManager.cs # common/ASC.Core.Common/EF/Context/FeedDbContext.cs # common/ASC.Core.Common/EF/Context/FilesDbContext.cs # common/ASC.Core.Common/EF/Context/MessagesContext.cs # common/ASC.Core.Common/EF/Context/ResourceDbContext.cs # common/ASC.Core.Common/EF/Context/TelegramDbContext.cs # common/ASC.Core.Common/EF/Context/WebstudioDbContext.cs # common/ASC.Core.Common/EF/Model/AccountLinks.cs # common/ASC.Core.Common/EF/Model/Core/Acl.cs # common/ASC.Core.Common/EF/Model/Core/DbCoreSettings.cs # common/ASC.Core.Common/EF/Model/Core/DbSubscriptionMethod.cs # common/ASC.Core.Common/EF/Model/Core/Subscription.cs # common/ASC.Core.Common/EF/Model/DbWebstudioSettings.cs # common/ASC.Core.Common/EF/Model/DbWebstudioUservisit.cs # common/ASC.Core.Common/EF/Model/Feed/FeedReaded.cs # common/ASC.Core.Common/EF/Model/Feed/FeedUsers.cs # common/ASC.Core.Common/EF/Model/FilesConverts.cs # common/ASC.Core.Common/EF/Model/MobileAppInstall.cs # common/ASC.Core.Common/EF/Model/Resource/ResAuthorsFile.cs # common/ASC.Core.Common/EF/Model/Resource/ResAuthorsLang.cs # common/ASC.Core.Common/EF/Model/TelegramUser.cs # common/ASC.Core.Common/EF/Model/Tenant/DbButton.cs # common/ASC.Core.Common/EF/Model/Tenant/DbQuotaRow.cs # common/ASC.Core.Common/EF/Model/User/UserGroup.cs # common/ASC.Core.Common/HostedSolution.cs # common/ASC.Core.Common/Security/EmailValidationKeyProvider.cs # common/ASC.Data.Reassigns/QueueWorker.cs # common/ASC.Data.Reassigns/ReassignProgressItem.cs # common/ASC.Data.Reassigns/RemoveProgressItem.cs # common/ASC.VoipService/Dao/CachedVoipDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs # products/ASC.Files/Core/Core/EF/DbEncryptedData.cs # products/ASC.Files/Core/Core/EF/DbFile.cs # products/ASC.Files/Core/Core/EF/DbFilesBunchObjects.cs # products/ASC.Files/Core/Core/EF/DbFilesSecurity.cs # products/ASC.Files/Core/Core/EF/DbFilesTagLink.cs # products/ASC.Files/Core/Core/EF/DbFilesThirdpartyApp.cs # products/ASC.Files/Core/Core/EF/DbFilesThirdpartyIdMapping.cs # products/ASC.Files/Core/Core/EF/DbFolderTree.cs # products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs # products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs # products/ASC.Files/Core/Core/Thirdparty/CachedProviderAccountDao.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderSecutiryDao.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderTagDao.cs # products/ASC.Files/Core/Utils/EntryManager.cs # products/ASC.Files/Server/Startup.cs # web/ASC.Web.Studio/Startup.cs
2020-10-09 12:40:44 +00:00
}
2019-12-17 08:27:38 +00:00
}
2019-11-29 12:26:53 +00:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
2020-09-06 22:49:03 +00:00
ModelBuilderWrapper
.From(modelBuilder, Provider)
2019-12-17 13:01:59 +00:00
.AddAcl()
.AddDbButton()
2020-09-06 22:49:03 +00:00
.AddDbQuotaRow()
.AddDbQuota()
2020-10-05 10:02:28 +00:00
.AddDbTariff();
2019-11-29 12:26:53 +00:00
}
}
2019-11-29 13:47:05 +00:00
2019-12-17 13:01:59 +00:00
2019-11-29 13:47:05 +00:00
public static class CoreDbExtension
{
2020-02-17 08:58:14 +00:00
public static DIHelper AddCoreDbContextService(this DIHelper services)
2019-11-29 13:47:05 +00:00
{
2019-12-10 15:06:51 +00:00
return services.AddDbContextManagerService<CoreDbContext>();
2019-11-29 13:47:05 +00:00
}
}
2019-11-29 12:26:53 +00:00
}