Browse Source

Merge pull request #7511 from abpframework/auto-merge/rel-4-2/137

Merge branch dev with rel-4.2
pull/7532/head
Halil İbrahim Kalkan 5 years ago
committed by GitHub
parent
commit
1e1794de5f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 64
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs
  2. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs
  3. 14
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs
  4. 23
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs
  5. 13
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs
  6. 29
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
  7. 59
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs
  8. 20
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs
  9. 26
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs
  10. 6
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs
  11. 4
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs
  12. 4
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs
  13. 2
      modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs
  14. 6
      modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobContainer.cs
  15. 6
      modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs
  16. 4
      modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs
  17. 2
      modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs
  18. 4
      modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs
  19. 1
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Project.cs
  20. 4
      modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs
  21. 4
      modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs
  22. 2
      modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs
  23. 4
      modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs
  24. 6
      modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs
  25. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs
  26. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs
  27. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs
  28. 4
      modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs
  29. 2
      modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs
  30. 4
      modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs
  31. 4
      modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs
  32. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs
  33. 2
      modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs
  34. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs
  35. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs

64
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs

@ -1,7 +1,15 @@
using System.Threading.Tasks;
using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.RequestLocalization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Settings;
namespace Volo.Abp.AspNetCore.MultiTenancy
{
@ -23,8 +31,62 @@ namespace Volo.Abp.AspNetCore.MultiTenancy
var tenant = await _tenantConfigurationProvider.GetAsync(saveResolveResult: true);
using (_currentTenant.Change(tenant?.Id, tenant?.Name))
{
var requestCulture = await TryGetRequestCultureAsync(context);
if (requestCulture != null)
{
CultureInfo.CurrentCulture = requestCulture.Culture;
CultureInfo.CurrentUICulture = requestCulture.UICulture;
AbpRequestCultureCookieHelper.SetCultureCookie(
context,
requestCulture
);
}
await next(context);
}
}
private async Task<RequestCulture> TryGetRequestCultureAsync(HttpContext httpContext)
{
var requestCultureFeature = httpContext.Features.Get<IRequestCultureFeature>();
/* If requestCultureFeature == null, that means the RequestLocalizationMiddleware was not used
* and we don't want to set the culture. */
if (requestCultureFeature == null)
{
return null;
}
/* If requestCultureFeature.Provider is not null, that means RequestLocalizationMiddleware
* already picked a language, so we don't need to set the default. */
if (requestCultureFeature.Provider != null)
{
return null;
}
var settingProvider = httpContext.RequestServices.GetRequiredService<ISettingProvider>();
var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage);
if (defaultLanguage.IsNullOrWhiteSpace())
{
return null;
}
string culture;
string uiCulture;
if (defaultLanguage.Contains(';'))
{
var splitted = defaultLanguage.Split(';');
culture = splitted[0];
uiCulture = splitted[1];
}
else
{
culture = defaultLanguage;
uiCulture = defaultLanguage;
}
return new RequestCulture(CultureInfo.GetCultureInfo(culture), CultureInfo.GetCultureInfo(uiCulture));
}
}
}

3
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs

@ -7,7 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
{
public static string CreateCacheKey(ICurrentUser currentUser)
{
return $"ApplicationConfiguration_{currentUser.Id?.ToString("N") ?? "Anonymous"}_{CultureInfo.CurrentUICulture.Name}";
var userKey = currentUser.Id?.ToString("N") ?? "Anonymous";
return $"ApplicationConfiguration_{userKey}_{CultureInfo.CurrentUICulture.Name}";
}
}
}

14
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using System;
using Microsoft.AspNetCore.RequestLocalization;
using Volo.Abp.Localization;
namespace Volo.Abp.AspNetCore.Mvc.Localization
@ -20,12 +20,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization
throw new AbpException("Unknown language: " + culture + ". It must be a valid culture!");
}
string cookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture, uiCulture));
Response.Cookies.Append(CookieRequestCultureProvider.DefaultCookieName, cookieValue, new CookieOptions
{
Expires = Clock.Now.AddYears(2)
});
AbpRequestCultureCookieHelper.SetCultureCookie(
HttpContext,
new RequestCulture(culture, uiCulture)
);
if (!string.IsNullOrWhiteSpace(returnUrl))
{

23
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs

@ -0,0 +1,23 @@
using System;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
namespace Microsoft.AspNetCore.RequestLocalization
{
public static class AbpRequestCultureCookieHelper
{
public static void SetCultureCookie(
HttpContext httpContext,
RequestCulture requestCulture)
{
httpContext.Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(requestCulture),
new CookieOptions
{
Expires = DateTime.Now.AddYears(2)
}
);
}
}
}

13
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs

@ -1,7 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
@ -15,6 +13,17 @@ namespace Volo.Abp.Domain.Entities
/// </summary>
public static class EntityHelper
{
public static bool IsMultiTenant<TEntity>()
where TEntity : IEntity
{
return IsMultiTenant(typeof(TEntity));
}
public static bool IsMultiTenant(Type type)
{
return typeof(IMultiTenant).IsAssignableFrom(type);
}
public static bool EntityEquals(IEntity entity1, IEntity entity2)
{
if (entity1 == null || entity2 == null)

29
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

@ -13,6 +13,7 @@ using Volo.Abp.Domain.Entities;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
{
@ -21,18 +22,42 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
where TEntity : class, IEntity
{
[Obsolete("Use GetDbContextAsync() method.")]
protected virtual TDbContext DbContext => _dbContextProvider.GetDbContext();
protected virtual TDbContext DbContext => GetDbContext();
[Obsolete("Use GetDbContextAsync() method.")]
DbContext IEfCoreRepository<TEntity>.DbContext => DbContext.As<DbContext>();
DbContext IEfCoreRepository<TEntity>.DbContext => GetDbContext() as DbContext;
async Task<DbContext> IEfCoreRepository<TEntity>.GetDbContextAsync()
{
return await GetDbContextAsync() as DbContext;
}
[Obsolete("Use GetDbContextAsync() method.")]
private TDbContext GetDbContext()
{
// Multi-tenancy unaware entities should always use the host connection string
if (!EntityHelper.IsMultiTenant<TEntity>())
{
using (CurrentTenant.Change(null))
{
return _dbContextProvider.GetDbContext();
}
}
return _dbContextProvider.GetDbContext();
}
protected virtual Task<TDbContext> GetDbContextAsync()
{
// Multi-tenancy unaware entities should always use the host connection string
if (!EntityHelper.IsMultiTenant<TEntity>())
{
using (CurrentTenant.Change(null))
{
return _dbContextProvider.GetDbContextAsync();
}
}
return _dbContextProvider.GetDbContextAsync();
}

59
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs

@ -1,24 +1,38 @@
using System;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Reflection;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Modeling;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
using Volo.Abp.Tracing;
namespace Volo.Abp.Http.Client.DynamicProxying
{
public class ApiDescriptionFinder : IApiDescriptionFinder, ITransientDependency
{
public ICancellationTokenProvider CancellationTokenProvider { get; set; }
protected IApiDescriptionCache Cache { get; }
public ApiDescriptionFinder(IApiDescriptionCache cache)
protected AbpCorrelationIdOptions AbpCorrelationIdOptions { get; }
protected ICorrelationIdProvider CorrelationIdProvider { get; }
protected ICurrentTenant CurrentTenant { get; }
public ApiDescriptionFinder(
IApiDescriptionCache cache,
IOptions<AbpCorrelationIdOptions> abpCorrelationIdOptions,
ICorrelationIdProvider correlationIdProvider,
ICurrentTenant currentTenant)
{
Cache = cache;
AbpCorrelationIdOptions = abpCorrelationIdOptions.Value;
CorrelationIdProvider = correlationIdProvider;
CurrentTenant = currentTenant;
CancellationTokenProvider = NullCancellationTokenProvider.Instance;
}
@ -71,10 +85,19 @@ namespace Volo.Abp.Http.Client.DynamicProxying
return await Cache.GetAsync(baseUrl, () => GetApiDescriptionFromServerAsync(client, baseUrl));
}
protected virtual async Task<ApplicationApiDescriptionModel> GetApiDescriptionFromServerAsync(HttpClient client, string baseUrl)
protected virtual async Task<ApplicationApiDescriptionModel> GetApiDescriptionFromServerAsync(
HttpClient client,
string baseUrl)
{
var response = await client.GetAsync(
baseUrl.EnsureEndsWith('/') + "api/abp/api-definition",
var requestMessage = new HttpRequestMessage(
HttpMethod.Get,
baseUrl.EnsureEndsWith('/') + "api/abp/api-definition"
);
AddHeaders(requestMessage);
var response = await client.SendAsync(
requestMessage,
CancellationTokenProvider.Token
);
@ -93,6 +116,30 @@ namespace Volo.Abp.Http.Client.DynamicProxying
return (ApplicationApiDescriptionModel)result;
}
protected virtual void AddHeaders(HttpRequestMessage requestMessage)
{
//CorrelationId
requestMessage.Headers.Add(AbpCorrelationIdOptions.HttpHeaderName, CorrelationIdProvider.Get());
//TenantId
if (CurrentTenant.Id.HasValue)
{
//TODO: Use AbpAspNetCoreMultiTenancyOptions to get the key
requestMessage.Headers.Add(TenantResolverConsts.DefaultTenantKey, CurrentTenant.Id.Value.ToString());
}
//Culture
//TODO: Is that the way we want? Couldn't send the culture (not ui culture)
var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name;
if (!currentCulture.IsNullOrEmpty())
{
requestMessage.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(currentCulture));
}
//X-Requested-With
requestMessage.Headers.Add("X-Requested-With", "XMLHttpRequest");
}
protected virtual bool TypeMatches(MethodParameterApiDescriptionModel actionParameter, ParameterInfo methodParameter)
{
return NormalizeTypeName(actionParameter.TypeAsString) ==

20
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs

@ -138,7 +138,13 @@ namespace Volo.Abp.Http.Client.DynamicProxying
var client = HttpClientFactory.Create(clientConfig.RemoteServiceName);
var action = await ApiDescriptionFinder.FindActionAsync(client, remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method);
var action = await ApiDescriptionFinder.FindActionAsync(
client,
remoteServiceConfig.BaseUrl,
typeof(TService),
invocation.Method
);
var apiVersion = GetApiVersionInfo(action);
var url = remoteServiceConfig.BaseUrl.EnsureEndsWith('/') + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion);
@ -158,9 +164,11 @@ namespace Volo.Abp.Http.Client.DynamicProxying
)
);
var response = await client.SendAsync(requestMessage,
var response = await client.SendAsync(
requestMessage,
HttpCompletionOption.ResponseHeadersRead /*this will buffer only the headers, the content will be used as a stream*/,
GetCancellationToken());
GetCancellationToken()
);
if (!response.IsSuccessStatusCode)
{
@ -198,7 +206,11 @@ namespace Volo.Abp.Http.Client.DynamicProxying
return action.SupportedVersions.Last(); //TODO: Ensure to get the latest version!
}
protected virtual void AddHeaders(IAbpMethodInvocation invocation, ActionApiDescriptionModel action, HttpRequestMessage requestMessage, ApiVersionInfo apiVersion)
protected virtual void AddHeaders(
IAbpMethodInvocation invocation,
ActionApiDescriptionModel action,
HttpRequestMessage requestMessage,
ApiVersionInfo apiVersion)
{
//API Version
if (!apiVersion.Version.IsNullOrEmpty())

26
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -52,10 +52,34 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
}
[Obsolete("Use GetDbContextAsync method.")]
protected virtual TMongoDbContext DbContext => DbContextProvider.GetDbContext();
protected virtual TMongoDbContext DbContext => GetDbContext();
[Obsolete("Use GetDbContextAsync method.")]
private TMongoDbContext GetDbContext()
{
// Multi-tenancy unaware entities should always use the host connection string
if (!EntityHelper.IsMultiTenant<TEntity>())
{
using (CurrentTenant.Change(null))
{
return DbContextProvider.GetDbContext();
}
}
return DbContextProvider.GetDbContext();
}
protected Task<TMongoDbContext> GetDbContextAsync(CancellationToken cancellationToken = default)
{
// Multi-tenancy unaware entities should always use the host connection string
if (!EntityHelper.IsMultiTenant<TEntity>())
{
using (CurrentTenant.Change(null))
{
return DbContextProvider.GetDbContextAsync(GetCancellationToken(cancellationToken));
}
}
return DbContextProvider.GetDbContextAsync(GetCancellationToken(cancellationToken));
}

6
modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs

@ -1,15 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public class BackgroundJobsDbContext : AbpDbContext<BackgroundJobsDbContext>, IBackgroundJobsDbContext
{
public DbSet<BackgroundJobRecord> BackgroundJobs { get; set; }
public BackgroundJobsDbContext(DbContextOptions<BackgroundJobsDbContext> options)
public BackgroundJobsDbContext(DbContextOptions<BackgroundJobsDbContext> options)
: base(options)
{
@ -22,4 +24,4 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
builder.ConfigureBackgroundJobs();
}
}
}
}

4
modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs

@ -1,12 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public interface IBackgroundJobsDbContext : IEfCoreDbContext
{
DbSet<BackgroundJobRecord> BackgroundJobs { get; }
}
}
}

4
modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs

@ -1,9 +1,11 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BackgroundJobs.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public class BackgroundJobsMongoDbContext : AbpMongoDbContext, IBackgroundJobsMongoDbContext
{
@ -16,4 +18,4 @@ namespace Volo.Abp.BackgroundJobs.MongoDB
modelBuilder.ConfigureBackgroundJobs();
}
}
}
}

2
modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs

@ -1,9 +1,11 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BackgroundJobs.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)]
public interface IBackgroundJobsMongoDbContext : IAbpMongoDbContext
{

6
modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobContainer.cs

@ -5,17 +5,17 @@ using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BlobStoring.Database
{
public class DatabaseBlobContainer : AggregateRoot<Guid>, IMultiTenant //TODO: Rename to BlobContainer
public class DatabaseBlobContainer : AggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual string Name { get; protected set; }
public DatabaseBlobContainer(Guid id, [NotNull] string name, Guid? tenantId = null)
public DatabaseBlobContainer(Guid id, [NotNull] string name, Guid? tenantId = null)
: base(id)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), DatabaseContainerConsts.MaxNameLength);
TenantId = tenantId;
}
}
}
}

6
modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
using Volo.Blogging.Blogs;
using Volo.Blogging.Comments;
using Volo.Blogging.Posts;
@ -9,6 +10,7 @@ using Volo.Blogging.Users;
namespace Volo.Blogging.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(BloggingDbProperties.ConnectionStringName)]
public class BloggingDbContext : AbpDbContext<BloggingDbContext>, IBloggingDbContext
{
@ -23,7 +25,7 @@ namespace Volo.Blogging.EntityFrameworkCore
public DbSet<PostTag> PostTags { get; set; }
public DbSet<Comment> Comments { get; set; }
public BloggingDbContext(DbContextOptions<BloggingDbContext> options)
: base(options)
{
@ -37,4 +39,4 @@ namespace Volo.Blogging.EntityFrameworkCore
builder.ConfigureBlogging();
}
}
}
}

4
modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
using Volo.Blogging.Blogs;
using Volo.Blogging.Comments;
using Volo.Blogging.Posts;
@ -9,6 +10,7 @@ using Volo.Blogging.Users;
namespace Volo.Blogging.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(BloggingDbProperties.ConnectionStringName)]
public interface IBloggingDbContext : IEfCoreDbContext
{
@ -24,4 +26,4 @@ namespace Volo.Blogging.EntityFrameworkCore
DbSet<Tag> Tags { get; set; }
}
}
}

2
modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs

@ -1,6 +1,7 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
using Volo.Blogging.Blogs;
using Volo.Blogging.Comments;
using Volo.Blogging.Posts;
@ -8,6 +9,7 @@ using Volo.Blogging.Users;
namespace Volo.Blogging.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(BloggingDbProperties.ConnectionStringName)]
public class BloggingMongoDbContext : AbpMongoDbContext, IBloggingMongoDbContext
{

4
modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs

@ -1,6 +1,7 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
using Volo.Blogging.Blogs;
using Volo.Blogging.Comments;
using Volo.Blogging.Posts;
@ -8,6 +9,7 @@ using Volo.Blogging.Users;
namespace Volo.Blogging.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(BloggingDbProperties.ConnectionStringName)]
public interface IBloggingMongoDbContext : IAbpMongoDbContext
{
@ -22,4 +24,4 @@ namespace Volo.Blogging.MongoDB
IMongoCollection<Comment> Comments { get; }
}
}
}

1
modules/docs/src/Volo.Docs.Domain/Volo/Docs/Projects/Project.cs

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp;
using Volo.Abp.Domain.Entities;

4
modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs

@ -1,11 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
using Volo.Docs.Documents;
using Volo.Docs.Projects;
namespace Volo.Docs.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(DocsDbProperties.ConnectionStringName)]
public class DocsDbContext: AbpDbContext<DocsDbContext>, IDocsDbContext
{
@ -15,7 +17,7 @@ namespace Volo.Docs.EntityFrameworkCore
public DbSet<DocumentContributor> DocumentContributors { get; set; }
public DocsDbContext(DbContextOptions<DocsDbContext> options)
public DocsDbContext(DbContextOptions<DocsDbContext> options)
: base(options)
{

4
modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs

@ -1,11 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
using Volo.Docs.Documents;
using Volo.Docs.Projects;
namespace Volo.Docs.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(DocsDbProperties.ConnectionStringName)]
public interface IDocsDbContext : IEfCoreDbContext
{
@ -15,4 +17,4 @@ namespace Volo.Docs.EntityFrameworkCore
DbSet<DocumentContributor> DocumentContributors { get; set; }
}
}
}

2
modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs

@ -2,10 +2,12 @@
using Volo.Abp.Data;
using Volo.Docs.Projects;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
using Volo.Docs.Documents;
namespace Volo.Docs.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(DocsDbProperties.ConnectionStringName)]
public class DocsMongoDbContext : AbpMongoDbContext, IDocsMongoDbContext
{

4
modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs

@ -1,11 +1,13 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
using Volo.Docs.Documents;
using Volo.Docs.Projects;
namespace Volo.Docs.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(DocsDbProperties.ConnectionStringName)]
public interface IDocsMongoDbContext : IAbpMongoDbContext
{
@ -13,4 +15,4 @@ namespace Volo.Docs.MongoDB
IMongoCollection<Document> Documents { get; }
}
}
}

6
modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs

@ -1,15 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public class FeatureManagementDbContext : AbpDbContext<FeatureManagementDbContext>, IFeatureManagementDbContext
{
public DbSet<FeatureValue> FeatureValues { get; set; }
public FeatureManagementDbContext(DbContextOptions<FeatureManagementDbContext> options)
public FeatureManagementDbContext(DbContextOptions<FeatureManagementDbContext> options)
: base(options)
{
@ -22,4 +24,4 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
builder.ConfigureFeatureManagement();
}
}
}
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs

@ -1,12 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.FeatureManagement.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public interface IFeatureManagementDbContext : IEfCoreDbContext
{
DbSet<FeatureValue> FeatureValues { get; set; }
}
}
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs

@ -1,9 +1,11 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.FeatureManagement.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public class FeatureManagementMongoDbContext : AbpMongoDbContext, IFeatureManagementMongoDbContext
{
@ -16,4 +18,4 @@ namespace Volo.Abp.FeatureManagement.MongoDB
modelBuilder.ConfigureFeatureManagement();
}
}
}
}

2
modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs

@ -1,9 +1,11 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.FeatureManagement.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)]
public interface IFeatureManagementMongoDbContext : IAbpMongoDbContext
{

4
modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs

@ -1,12 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.SettingManagement.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)]
public interface ISettingManagementDbContext : IEfCoreDbContext
{
DbSet<Setting> Settings { get; set; }
}
}
}

2
modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs

@ -1,9 +1,11 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.SettingManagement.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)]
public class SettingManagementDbContext : AbpDbContext<SettingManagementDbContext>, ISettingManagementDbContext
{

4
modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs

@ -1,12 +1,14 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.SettingManagement.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)]
public interface ISettingManagementMongoDbContext : IAbpMongoDbContext
{
IMongoCollection<Setting> Settings { get; }
}
}
}

4
modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs

@ -1,9 +1,11 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.SettingManagement.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)]
public class SettingManagementMongoDbContext : AbpMongoDbContext, ISettingManagementMongoDbContext
{
@ -16,4 +18,4 @@ namespace Volo.Abp.SettingManagement.MongoDB
modelBuilder.ConfigureSettingManagement();
}
}
}
}

4
modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs

@ -1,9 +1,11 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.TenantManagement.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)]
public interface ITenantManagementDbContext : IEfCoreDbContext
{
@ -11,4 +13,4 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore
DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
}
}
}

2
modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs

@ -1,9 +1,11 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.TenantManagement.EntityFrameworkCore
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)]
public class TenantManagementDbContext : AbpDbContext<TenantManagementDbContext>, ITenantManagementDbContext
{

4
modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs

@ -1,12 +1,14 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.TenantManagement.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)]
public interface ITenantManagementMongoDbContext : IAbpMongoDbContext
{
IMongoCollection<Tenant> Tenants { get; }
}
}
}

4
modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs

@ -1,9 +1,11 @@
using MongoDB.Driver;
using Volo.Abp.Data;
using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.TenantManagement.MongoDB
{
[IgnoreMultiTenancy]
[ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)]
public class TenantManagementMongoDbContext : AbpMongoDbContext, ITenantManagementMongoDbContext
{
@ -16,4 +18,4 @@ namespace Volo.Abp.TenantManagement.MongoDB
modelBuilder.ConfigureTenantManagement();
}
}
}
}

Loading…
Cancel
Save