Skip to content

Commit

Permalink
feat: 移除所有类名的Lion前缀,比如LionAbpProCliModule修改为AbpProCliModule
Browse files Browse the repository at this point in the history
  • Loading branch information
WangJunZzz committed Jul 3, 2023
1 parent fec8689 commit 0d1d9da
Show file tree
Hide file tree
Showing 72 changed files with 297 additions and 392 deletions.
35 changes: 35 additions & 0 deletions aspnet-core/Lion.AbpPro.All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.Core.Cli.Tests"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCompanyName.MyProjectName.WebGateway", "..\templates\abp-vnext-pro-nuget-all\aspnet-core\host\MyCompanyName.MyProjectName.WebGateway\MyCompanyName.MyProjectName.WebGateway.csproj", "{4C57F50E-50BE-4C1A-BBA3-9D0DA5BF4D6F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.ElasticSearch", "frameworks\src\Lion.AbpPro.ElasticSearch\Lion.AbpPro.ElasticSearch.csproj", "{021B499E-ABED-4D1D-B6EB-DC453B5A57A6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.EntityFrameworkCore", "frameworks\src\Lion.AbpPro.EntityFrameworkCore\Lion.AbpPro.EntityFrameworkCore.csproj", "{0329D6FA-5048-478C-A399-E9A8FD2B7DF4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.EntityFrameworkCore.Mysql", "frameworks\src\Lion.AbpPro.EntityFrameworkCore.Mysql\Lion.AbpPro.EntityFrameworkCore.Mysql.csproj", "{4E9F48F8-4EBB-4D47-BC10-35760EE4F645}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.ElasticSearch.Tests", "frameworks\test\Lion.AbpPro.ElasticSearch.Tests\Lion.AbpPro.ElasticSearch.Tests.csproj", "{A9824877-9F0C-4E33-BEFC-1DD62A365C75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.AbpPro.EntityFrameworkCore.Tests", "frameworks\test\Lion.AbpPro.EntityFrameworkCore.Mysql.Tests\Lion.AbpPro.EntityFrameworkCore.Tests.csproj", "{FFD342DF-87A5-4642-B694-58714C506883}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -918,6 +928,26 @@ Global
{4C57F50E-50BE-4C1A-BBA3-9D0DA5BF4D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C57F50E-50BE-4C1A-BBA3-9D0DA5BF4D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C57F50E-50BE-4C1A-BBA3-9D0DA5BF4D6F}.Release|Any CPU.Build.0 = Release|Any CPU
{021B499E-ABED-4D1D-B6EB-DC453B5A57A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{021B499E-ABED-4D1D-B6EB-DC453B5A57A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{021B499E-ABED-4D1D-B6EB-DC453B5A57A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{021B499E-ABED-4D1D-B6EB-DC453B5A57A6}.Release|Any CPU.Build.0 = Release|Any CPU
{0329D6FA-5048-478C-A399-E9A8FD2B7DF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0329D6FA-5048-478C-A399-E9A8FD2B7DF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0329D6FA-5048-478C-A399-E9A8FD2B7DF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0329D6FA-5048-478C-A399-E9A8FD2B7DF4}.Release|Any CPU.Build.0 = Release|Any CPU
{4E9F48F8-4EBB-4D47-BC10-35760EE4F645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E9F48F8-4EBB-4D47-BC10-35760EE4F645}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E9F48F8-4EBB-4D47-BC10-35760EE4F645}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E9F48F8-4EBB-4D47-BC10-35760EE4F645}.Release|Any CPU.Build.0 = Release|Any CPU
{A9824877-9F0C-4E33-BEFC-1DD62A365C75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9824877-9F0C-4E33-BEFC-1DD62A365C75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9824877-9F0C-4E33-BEFC-1DD62A365C75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9824877-9F0C-4E33-BEFC-1DD62A365C75}.Release|Any CPU.Build.0 = Release|Any CPU
{FFD342DF-87A5-4642-B694-58714C506883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFD342DF-87A5-4642-B694-58714C506883}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFD342DF-87A5-4642-B694-58714C506883}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFD342DF-87A5-4642-B694-58714C506883}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1093,6 +1123,11 @@ Global
{2DDC4639-710D-4B9C-98E0-03288184B37C} = {18E9B97A-3897-4DA8-810E-4435A777ABA7}
{9B65C2C8-E94E-46FD-9841-70DFAE5C85E9} = {EFC415F8-872F-4C7E-8645-31A51481BCFC}
{4C57F50E-50BE-4C1A-BBA3-9D0DA5BF4D6F} = {EA151482-0987-49E0-96A8-2CD876BC8B6E}
{021B499E-ABED-4D1D-B6EB-DC453B5A57A6} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{0329D6FA-5048-478C-A399-E9A8FD2B7DF4} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{4E9F48F8-4EBB-4D47-BC10-35760EE4F645} = {7BE85EBC-99AD-4CDE-957E-4BDD087FC4E3}
{A9824877-9F0C-4E33-BEFC-1DD62A365C75} = {EFC415F8-872F-4C7E-8645-31A51481BCFC}
{FFD342DF-87A5-4642-B694-58714C506883} = {EFC415F8-872F-4C7E-8645-31A51481BCFC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

global using System.Collections.Concurrent;
global using DotNetCore.CAP;
global using Lion.AbpPro.CAP.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Storage;
global using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore;

public class LionAbpProLionAbpProCapDbProviderInfoProvider : ILionAbpProCapDbProviderInfoProvider, ITransientDependency
public class AbpProAbpProCapDbProviderInfoProvider : IAbpProCapDbProviderInfoProvider, ITransientDependency
{
protected ConcurrentDictionary<string, LionAbpProCapDbProviderInfo> CapDbProviderInfos { get; set; } = new();
protected ConcurrentDictionary<string, AbpProCapDbProviderInfo> CapDbProviderInfos { get; set; } = new();

public virtual LionAbpProCapDbProviderInfo GetOrNull(string dbProviderName)
public virtual AbpProCapDbProviderInfo GetOrNull(string dbProviderName)
{
return CapDbProviderInfos.GetOrAdd(dbProviderName, InternalGetOrNull);
}

protected virtual LionAbpProCapDbProviderInfo InternalGetOrNull(string databaseProviderName)
protected virtual AbpProCapDbProviderInfo InternalGetOrNull(string databaseProviderName)
{
switch (databaseProviderName)
{
case "Microsoft.EntityFrameworkCore.SqlServer":
return new LionAbpProCapDbProviderInfo(
return new AbpProCapDbProviderInfo(
"DotNetCore.CAP.SqlServerCapTransaction, DotNetCore.CAP.SqlServer",
"Microsoft.EntityFrameworkCore.Storage.CapEFDbTransaction, DotNetCore.CAP.SqlServer");
case "Npgsql.EntityFrameworkCore.PostgreSQL":
return new LionAbpProCapDbProviderInfo(
return new AbpProCapDbProviderInfo(
"DotNetCore.CAP.PostgreSqlCapTransaction, DotNetCore.CAP.PostgreSql",
"Microsoft.EntityFrameworkCore.Storage.CapEFDbTransaction, DotNetCore.CAP.PostgreSQL");
case "Pomelo.EntityFrameworkCore.MySql":
return new LionAbpProCapDbProviderInfo(
return new AbpProCapDbProviderInfo(
"DotNetCore.CAP.MySqlCapTransaction, DotNetCore.CAP.MySql",
"Microsoft.EntityFrameworkCore.Storage.CapEFDbTransaction, DotNetCore.CAP.MySql");
case "Oracle.EntityFrameworkCore":
case "Devart.Data.Oracle.Entity.EFCore":
return new LionAbpProCapDbProviderInfo(
return new AbpProCapDbProviderInfo(
"DotNetCore.CAP.OracleCapTransaction, DotNetCore.CAP.Oracle",
"Microsoft.EntityFrameworkCore.Storage.CapEFDbTransaction, DotNetCore.CAP.Oracle");
case "Microsoft.EntityFrameworkCore.Sqlite":
return new LionAbpProCapDbProviderInfo(
return new AbpProCapDbProviderInfo(
"DotNetCore.CAP.SqliteCapTransaction, DotNetCore.CAP.Sqlite",
"Microsoft.EntityFrameworkCore.Storage.CapEFDbTransaction, DotNetCore.CAP.Sqlite");
case "Microsoft.EntityFrameworkCore.InMemory":
return new LionAbpProCapDbProviderInfo(
return new AbpProCapDbProviderInfo(
"DotNetCore.CAP.InMemoryCapTransaction, DotNetCore.CAP.InMemoryStorage",
"Microsoft.EntityFrameworkCore.Storage.CapEFDbTransaction, DotNetCore.CAP.InMemoryStorage");
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore;

public class LionAbpProCapDbProviderInfo
public class AbpProCapDbProviderInfo
{
public Type CapTransactionType { get; }

public Type CapEfDbTransactionType { get; }

public LionAbpProCapDbProviderInfo(string capTransactionTypeName, string capEfDbTransactionTypeName)
public AbpProCapDbProviderInfo(string capTransactionTypeName, string capEfDbTransactionTypeName)
{
CapTransactionType = Type.GetType(capTransactionTypeName, false);
CapEfDbTransactionType = Type.GetType(capEfDbTransactionTypeName, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore
{
[DependsOn(typeof(AbpProCapModule))]
public class AbpProCapEntityFrameworkCoreModule : AbpModule
{
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using Lion.AbpPro.CAP.EntityFrameworkCore;

// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection
{
public static class LionAbpProCapOptionsExtensions
public static class AbpProCapOptionsExtensions
{
public static CapOptions SetCapDbConnectionString(this CapOptions options, string dbConnectionString)
{
options.RegisterExtension(new LionAbpProEfCoreDbContextCapOptionsExtension
options.RegisterExtension(new AbpProEfCoreDbContextCapOptionsExtension
{
CapUsingDbConnectionString = dbConnectionString
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore;

public class LionAbpProEfCoreDbContextCapOptions
public class AbpProEfCoreDbContextCapOptions
{
public string CapUsingDbConnectionString { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore;

public class LionAbpProEfCoreDbContextCapOptionsExtension : ICapOptionsExtension
public class AbpProEfCoreDbContextCapOptionsExtension : ICapOptionsExtension
{
public string CapUsingDbConnectionString { get; init; }

public void AddServices(IServiceCollection services)
{
services.Configure<LionAbpProEfCoreDbContextCapOptions>(options =>
services.Configure<AbpProEfCoreDbContextCapOptions>(options =>
{
options.CapUsingDbConnectionString = CapUsingDbConnectionString;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore;

public class EfCoreLionAbpProCapTransactionApiFactory : ILionAbpProCapTransactionApiFactory, ITransientDependency
public class EfCoreAbpProCapTransactionApiFactory : IAbpProCapTransactionApiFactory, ITransientDependency
{
public Type TransactionApiType { get; } = typeof(EfCoreTransactionApi);

protected readonly ICapPublisher Publisher;
protected readonly LionAbpProEfCoreDbContextCapOptions Options;
protected readonly ILionAbpProCapDbProviderInfoProvider LionAbpProCapDbProviderInfoProvider;
protected readonly AbpProEfCoreDbContextCapOptions Options;
protected readonly IAbpProCapDbProviderInfoProvider AbpProCapDbProviderInfoProvider;
protected readonly ICancellationTokenProvider CancellationTokenProvider;

public EfCoreLionAbpProCapTransactionApiFactory(
public EfCoreAbpProCapTransactionApiFactory(
ICapPublisher publisher,
IOptions<LionAbpProEfCoreDbContextCapOptions> options,
ILionAbpProCapDbProviderInfoProvider lionAbpProCapDbProviderInfoProvider,
IOptions<AbpProEfCoreDbContextCapOptions> options,
IAbpProCapDbProviderInfoProvider abpProCapDbProviderInfoProvider,
ICancellationTokenProvider cancellationTokenProvider)
{
Publisher = publisher;
Options = options.Value;
LionAbpProCapDbProviderInfoProvider = lionAbpProCapDbProviderInfoProvider;
AbpProCapDbProviderInfoProvider = abpProCapDbProviderInfoProvider;
CancellationTokenProvider = cancellationTokenProvider;
}

Expand All @@ -40,7 +40,7 @@ protected virtual IDbContextTransaction CreateCapTransactionOrNull(EfCoreTransac
// return null;
// }

var dbProviderInfo = LionAbpProCapDbProviderInfoProvider.GetOrNull(originalApi.StarterDbContext.Database.ProviderName);
var dbProviderInfo = AbpProCapDbProviderInfoProvider.GetOrNull(originalApi.StarterDbContext.Database.ProviderName);

if (dbProviderInfo?.CapTransactionType is null || dbProviderInfo.CapEfDbTransactionType is null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Lion.AbpPro.CAP.EntityFrameworkCore;

public interface IAbpProCapDbProviderInfoProvider
{
AbpProCapDbProviderInfo GetOrNull(string dbProviderName);
}

This file was deleted.

This file was deleted.

10 changes: 9 additions & 1 deletion aspnet-core/frameworks/src/Lion.AbpPro.CAP/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// Global using directives

global using Volo.Abp.Authorization.Permissions;
global using System.Text;
global using System.Text.Json;
global using DotNetCore.CAP.Messages;
global using DotNetCore.CAP.Serialization;
global using Lion.AbpPro.Localization;
global using Microsoft.Extensions.DependencyInjection.Extensions;
global using Volo.Abp.Authorization.Permissions;
global using Volo.Abp.Json;
global using Volo.Abp.Localization;
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
namespace Lion.AbpPro.CAP;

public class LionAbpProCapConsumerServiceSelector : ConsumerServiceSelector, ISingletonDependency
public class AbpProCapConsumerServiceSelector : ConsumerServiceSelector, ISingletonDependency
{
protected AbpDistributedEventBusOptions AbpDistributedEventBusOptions { get; }
protected IServiceProvider ServiceProvider { get; }

/// <summary>
/// Creates a new <see cref="T:DotNetCore.CAP.Internal.ConsumerServiceSelector" />.
/// </summary>
public LionAbpProCapConsumerServiceSelector(IServiceProvider serviceProvider, IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions) : base(serviceProvider)
public AbpProCapConsumerServiceSelector(IServiceProvider serviceProvider, IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions) : base(serviceProvider)
{
ServiceProvider = serviceProvider;
AbpDistributedEventBusOptions = distributedEventBusOptions.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lion.AbpPro.CAP;

public class LionAbpProCapDistributedEventBus : EventBusBase, IDistributedEventBus, ISingletonDependency
public class AbpProCapDistributedEventBus : EventBusBase, IDistributedEventBus, ISingletonDependency
{
protected AbpDistributedEventBusOptions AbpDistributedEventBusOptions { get; }
protected readonly ICapPublisher CapPublisher;
Expand All @@ -9,7 +9,7 @@ public class LionAbpProCapDistributedEventBus : EventBusBase, IDistributedEventB
protected ConcurrentDictionary<Type, List<IEventHandlerFactory>> HandlerFactories { get; }
protected ConcurrentDictionary<string, Type> EventTypes { get; }

public LionAbpProCapDistributedEventBus(IServiceScopeFactory serviceScopeFactory,
public AbpProCapDistributedEventBus(IServiceScopeFactory serviceScopeFactory,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions,
ICapPublisher capPublisher,
IUnitOfWorkManager unitOfWorkManager,
Expand Down Expand Up @@ -104,7 +104,7 @@ public virtual async Task PublishAsync(Type eventType, object eventData, bool on

if (useOutbox && UnitOfWorkManager.Current != null)
{
if (UnitOfWorkManager.Current is not LionAbpProCapUnitOfWork capUnitOfWork || capUnitOfWork.CapTransaction is null)
if (UnitOfWorkManager.Current is not AbpProCapUnitOfWork capUnitOfWork || capUnitOfWork.CapTransaction is null)
{
UnitOfWorkManager.Current.OnCompleted(async () =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ namespace Lion.AbpPro.CAP;

[DependsOn(
typeof(AbpEventBusModule),
typeof(LionAbpProLocalizationModule),
typeof(AbpProLocalizationModule),
typeof(AbpUnitOfWorkModule))]
public class LionAbpProCapModule : AbpModule
public class AbpProCapModule : AbpModule
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Lion.AbpPro.CAP;

public class AbpProCapPermissionDefinitionProvider : PermissionDefinitionProvider
{
public override void Define(IPermissionDefinitionContext context)
{
var abpIdentityGroup = context.GetGroup(AbpProCapPermissions.CapManagement.Default);

abpIdentityGroup.AddPermission(AbpProCapPermissions.CapManagement.Cap, L("Permission:Cap"));
}

private static LocalizableString L(string name)
{
return LocalizableString.Create<AbpProLocalizationResource>(name);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lion.AbpPro.CAP;

public static class LionAbpProCapPermissions
public static class AbpProCapPermissions
{

public static class CapManagement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lion.AbpPro.CAP;

public static class LionAbpProCapPublisherExtension
public static class AbpProCapPublisherExtension
{
public static IDisposable UseTransaction(this ICapPublisher capPublisher, ICapTransaction capTransaction)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Lion.AbpPro.CAP;

public static class AbpProCapServiceCollectionExtensions
{
public static ServiceConfigurationContext AddAbpCap(this ServiceConfigurationContext context, Action<CapOptions> capAction)
{
context.Services.Replace(ServiceDescriptor.Transient<IUnitOfWork, AbpProCapUnitOfWork>());
context.Services.Replace(ServiceDescriptor.Transient<UnitOfWork, AbpProCapUnitOfWork>());
context.Services.AddTransient<AbpProCapUnitOfWork>();
context.Services.AddCap(capAction);
return context;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace Lion.AbpPro.CAP;

[Dependency(TryRegister = true)]
public class LionAbpProCapUnitOfWork : UnitOfWork
public class AbpProCapUnitOfWork : UnitOfWork
{
public ICapTransaction CapTransaction { get; protected set; }

protected ICapPublisher CapPublisher { get; }

public LionAbpProCapUnitOfWork(
public AbpProCapUnitOfWork(
IServiceProvider serviceProvider,
IUnitOfWorkEventPublisher unitOfWorkEventPublisher,
IOptions<AbpUnitOfWorkDefaultOptions> options,
Expand All @@ -19,7 +19,7 @@ public LionAbpProCapUnitOfWork(

public override void AddTransactionApi(string key, ITransactionApi api)
{
var factories = ServiceProvider.GetServices<ILionAbpProCapTransactionApiFactory>();
var factories = ServiceProvider.GetServices<IAbpProCapTransactionApiFactory>();

var factory = factories.FirstOrDefault(x => x.TransactionApiType == api.GetType());

Expand Down
Loading

0 comments on commit 0d1d9da

Please sign in to comment.