Skip to content

Commit

Permalink
fix: add virtual to all public method
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnkwlp committed Nov 9, 2023
1 parent 764fadf commit 0ba9148
Show file tree
Hide file tree
Showing 81 changed files with 226 additions and 265 deletions.
4 changes: 2 additions & 2 deletions host/src/Sample.DbMigrator/DbMigratorHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime,
_configuration = configuration;
}

public async Task StartAsync(CancellationToken cancellationToken)
public virtual async Task StartAsync(CancellationToken cancellationToken)
{
using (var application = await AbpApplicationFactory.CreateAsync<SampleDbMigratorModule>(options =>
{
Expand All @@ -44,7 +44,7 @@ await application
}
}

public Task StopAsync(CancellationToken cancellationToken)
public virtual Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
Expand Down
2 changes: 1 addition & 1 deletion host/src/Sample.Domain/Data/NullSampleDbSchemaMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Sample.Data;
*/
public class NullSampleDbSchemaMigrator : ISampleDbSchemaMigrator, ITransientDependency
{
public Task MigrateAsync()
public virtual Task MigrateAsync()
{
return Task.CompletedTask;
}
Expand Down
2 changes: 1 addition & 1 deletion host/src/Sample.Domain/Data/SampleDbMigrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public SampleDbMigrationService(
Logger = NullLogger<SampleDbMigrationService>.Instance;
}

public async Task MigrateAsync()
public virtual async Task MigrateAsync()
{
var initialMigrationAdded = AddInitialMigrationIfNotExist();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public EntityFrameworkCoreSampleDbSchemaMigrator(
_serviceProvider = serviceProvider;
}

public async Task MigrateAsync()
public virtual async Task MigrateAsync()
{
/* We intentionally resolving the SampleDbContext
* from IServiceProvider (instead of directly injecting it)
Expand Down
9 changes: 9 additions & 0 deletions modules/account/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
<Product>Passingwind.Abp.Account</Product>
<Description>an abp module that provider account service, such as login, 2fa, account settings. </Description>
<PackageTags>abp-module</PackageTags>
<Version>0.2.0</Version>
<PackageVersion>0.2.9</PackageVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
14 changes: 0 additions & 14 deletions modules/account/src/Directory.Build.props

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public virtual async Task LoginAsync(Guid userId)
await ImpersonateLoginAsync(user);
}

public async Task LinkLoginAsync(Guid userId)
public virtual async Task LinkLoginAsync(Guid userId)
{
await IdentityOptions.SetAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class AccountTfaAppService : AccountAppBaseService, IAccountTfaAppService
protected IdentityUserManager UserManager { get; }
protected IdentitySecurityLogManager SecurityLogManager { get; }
protected IOptions<IdentityOptions> IdentityOptions { get; }
protected IAccountTwoFactorTokenSender AccountTwoFactorTokenSender { get; }
protected IdentityUserTwoFactorManager UserTwoFactorManager { get; }
protected IOptions<IdentityUserTokenOptions> UserTokenOptions { get; }

Expand All @@ -34,15 +33,13 @@ public AccountTfaAppService(
IdentityUserManager userManager,
IdentitySecurityLogManager securityLogManager,
IOptions<IdentityOptions> identityOptions,
IAccountTwoFactorTokenSender accountTwoFactorTokenSender,
IdentityUserTwoFactorManager userTwoFactorManager,
IOptions<IdentityUserTokenOptions> userTokenOptions)
{
SignInManager = signInManager;
UserManager = userManager;
SecurityLogManager = securityLogManager;
IdentityOptions = identityOptions;
AccountTwoFactorTokenSender = accountTwoFactorTokenSender;
UserTwoFactorManager = userTwoFactorManager;
UserTokenOptions = userTokenOptions;
}
Expand Down Expand Up @@ -362,7 +359,7 @@ public virtual async Task EnabledPhoneNumberTokenProviderAsync()
await UserTwoFactorManager.SetPhoneNumberTokenEnabledAsync(user, true);
}

public async Task DisabledEmailTokenProviderAsync()
public virtual async Task DisabledEmailTokenProviderAsync()
{
await IdentityOptions.SetAsync();

Expand All @@ -382,7 +379,7 @@ public async Task DisabledEmailTokenProviderAsync()
}
}

public async Task DisabledPhoneNumberTokenProviderAsync()
public virtual async Task DisabledPhoneNumberTokenProviderAsync()
{
await IdentityOptions.SetAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public virtual async Task SetSecurityLogsSettingsAsync(AccountSecurityLogsSettin
await SetSettingValueAsync(AccountSettingNames.SecurityLogs.AllowUserDelete, settings.AllowUserDelete);
}

public async Task<AccountExternalLoginSettings> GetExternalLoginSettingsAsync(CancellationToken cancellationToken = default)
public virtual async Task<AccountExternalLoginSettings> GetExternalLoginSettingsAsync(CancellationToken cancellationToken = default)
{
return new AccountExternalLoginSettings
{
Expand All @@ -125,7 +125,7 @@ public async Task<AccountExternalLoginSettings> GetExternalLoginSettingsAsync(Ca
};
}

public async Task SetExternalLoginSettingsAsync(AccountExternalLoginSettings settings, CancellationToken cancellationToken = default)
public virtual async Task SetExternalLoginSettingsAsync(AccountExternalLoginSettings settings, CancellationToken cancellationToken = default)
{
await SetSettingValueAsync(AccountSettingNames.ExternalLogin.AutoCreateUser, settings.AutoCreateUser);
await SetSettingValueAsync(AccountSettingNames.ExternalLogin.BypassTwofactory, settings.BypassTwofactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,61 @@ public AccountAdminSettingsController(IAccountAdminSettingsAppService service)
}

[HttpGet]
public Task<AccountAdminSettingsDto> GetAsync()
public virtual Task<AccountAdminSettingsDto> GetAsync()
{
return _service.GetAsync();
}

[HttpGet("captcha")]
public Task<AccountCaptchaSettingsDto> GetCaptchaAsync()
public virtual Task<AccountCaptchaSettingsDto> GetCaptchaAsync()
{
return _service.GetCaptchaAsync();
}

[HttpGet("external-login")]
public Task<AccountExternalLoginSettingsDto> GetExternalLoginAsync()
public virtual Task<AccountExternalLoginSettingsDto> GetExternalLoginAsync()
{
return _service.GetExternalLoginAsync();
}

[HttpGet("general")]
public Task<AccountGeneralSettingsDto> GetGeneralAsync()
public virtual Task<AccountGeneralSettingsDto> GetGeneralAsync()
{
return _service.GetGeneralAsync();
}

[HttpGet("recaptcha")]
public Task<AccountRecaptchaSettingsDto> GetRecaptchaAsync()
public virtual Task<AccountRecaptchaSettingsDto> GetRecaptchaAsync()
{
return _service.GetRecaptchaAsync();
}

[HttpPut]
public Task UpdateAsync(AccountAdminSettingsDto input)
public virtual Task UpdateAsync(AccountAdminSettingsDto input)
{
return _service.UpdateAsync(input);
}

[HttpPut("captcha")]
public Task UpdateCaptchaAsync(AccountCaptchaSettingsDto input)
public virtual Task UpdateCaptchaAsync(AccountCaptchaSettingsDto input)
{
return _service.UpdateCaptchaAsync(input);
}

[HttpPut("external-login")]
public Task UpdateExternalLoginAsync(AccountExternalLoginSettingsDto input)
public virtual Task UpdateExternalLoginAsync(AccountExternalLoginSettingsDto input)
{
return _service.UpdateExternalLoginAsync(input);
}

[HttpPut("general")]
public Task UpdateGeneralAsync(AccountGeneralSettingsDto input)
public virtual Task UpdateGeneralAsync(AccountGeneralSettingsDto input)
{
return _service.UpdateGeneralAsync(input);
}

[HttpPut("recaptcha")]
public Task UpdateRecaptchaAsync(AccountRecaptchaSettingsDto input)
public virtual Task UpdateRecaptchaAsync(AccountRecaptchaSettingsDto input)
{
return _service.UpdateRecaptchaAsync(input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public virtual Task LoginAsync(Guid userId)

/// <inheritdoc/>
[HttpPost("{userId}/link-login")]
public Task LinkLoginAsync(Guid userId)
public virtual Task LinkLoginAsync(Guid userId)
{
return _service.LinkLoginAsync(userId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public virtual Task DisabledPhoneNumberTokenProviderAsync()
}

[HttpPut("preferred-provider")]
public Task UpdatePreferredProviderAsync(AccountUpdatePreferredProviderDto input)
public virtual Task UpdatePreferredProviderAsync(AccountUpdatePreferredProviderDto input)
{
return TfaAppService.UpdatePreferredProviderAsync(input);
}

[HttpGet("preferred-provider")]
public Task<AccountPreferredProviderDto> GetPreferredProviderAsync()
public virtual Task<AccountPreferredProviderDto> GetPreferredProviderAsync()
{
return TfaAppService.GetPreferredProviderAsync();
}
Expand Down
9 changes: 9 additions & 0 deletions modules/api-keys/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
<Product>Passingwind.Abp.ApiKey</Product>
<Description>an abp module that provider api key authentication and key management.</Description>
<PackageTags>abp-module, apikey</PackageTags>
<Version>0.2.0</Version>
<PackageVersion>0.2.2</PackageVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
14 changes: 0 additions & 14 deletions modules/api-keys/src/Directory.Build.props

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public ApiKeyRecordRepository(IDbContextProvider<ApiKeyDbContext> dbContextProvi
{
}

public async Task<ApiKeyRecord?> FindBySecretAsync(string value, CancellationToken cancellationToken = default)
public virtual async Task<ApiKeyRecord?> FindBySecretAsync(string value, CancellationToken cancellationToken = default)
{
var dbset = await GetDbSetAsync();

return await dbset
.FirstOrDefaultAsync(x => x.Secret == value, cancellationToken);
}

public async Task<long> GetCountAsync(string? filter = null, Guid? userId = null, CancellationToken cancellationToken = default)
public virtual async Task<long> GetCountAsync(string? filter = null, Guid? userId = null, CancellationToken cancellationToken = default)
{
var dbset = await GetDbSetAsync();

Expand All @@ -34,7 +34,7 @@ public async Task<long> GetCountAsync(string? filter = null, Guid? userId = null
.LongCountAsync(cancellationToken);
}

public async Task<List<ApiKeyRecord>> GetListAsync(string? filter = null, Guid? userId = null, bool includeDetails = false, CancellationToken cancellationToken = default)
public virtual async Task<List<ApiKeyRecord>> GetListAsync(string? filter = null, Guid? userId = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var dbset = await GetDbSetAsync();

Expand All @@ -44,7 +44,7 @@ public async Task<List<ApiKeyRecord>> GetListAsync(string? filter = null, Guid?
.ToListAsync(cancellationToken);
}

public async Task<List<ApiKeyRecord>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? userId = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default)
public virtual async Task<List<ApiKeyRecord>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? userId = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var dbset = await GetDbSetAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public ApiKeyRecordRepository(IMongoDbContextProvider<ApiKeyMongoDbContext> dbCo
{
}

public async Task<ApiKeyRecord?> FindBySecretAsync(string value, CancellationToken cancellationToken = default)
public virtual async Task<ApiKeyRecord?> FindBySecretAsync(string value, CancellationToken cancellationToken = default)
{
var query = await GetMongoQueryableAsync();

return await query
.FirstOrDefaultAsync(x => x.Secret == value, cancellationToken);
}

public async Task<long> GetCountAsync(string? filter = null, Guid? userId = null, CancellationToken cancellationToken = default)
public virtual async Task<long> GetCountAsync(string? filter = null, Guid? userId = null, CancellationToken cancellationToken = default)
{
var query = await GetMongoQueryableAsync();

Expand All @@ -36,7 +36,7 @@ public async Task<long> GetCountAsync(string? filter = null, Guid? userId = null
.LongCountAsync(cancellationToken);
}

public async Task<List<ApiKeyRecord>> GetListAsync(string? filter = null, Guid? userId = null, bool includeDetails = false, CancellationToken cancellationToken = default)
public virtual async Task<List<ApiKeyRecord>> GetListAsync(string? filter = null, Guid? userId = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var query = await GetMongoQueryableAsync();

Expand All @@ -47,7 +47,7 @@ public async Task<List<ApiKeyRecord>> GetListAsync(string? filter = null, Guid?
.ToListAsync(cancellationToken);
}

public async Task<List<ApiKeyRecord>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? userId = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default)
public virtual async Task<List<ApiKeyRecord>> GetPagedListAsync(int skipCount, int maxResultCount, string? filter = null, Guid? userId = null, string? sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default)
{
var query = await GetMongoQueryableAsync();

Expand Down
4 changes: 2 additions & 2 deletions modules/common.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.0</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<NoWarn>$(NoWarn);CS1591</NoWarn>


<IsPackable>true</IsPackable>
<Authors>Passingwind</Authors>
<Copyright>Passingwind</Copyright>
<PackageProjectUrl>https://github.com/jxnkwlp/abp-modules</PackageProjectUrl>
Expand Down
11 changes: 10 additions & 1 deletion modules/dictionary-management/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

<Import Project="..\common.props" />

<PropertyGroup>
<PropertyGroup>
<Product>Passingwind.Abp.DictionaryManagement</Product>
<Description>an abp module that provider dynamic dictionary management service</Description>
<PackageTags>abp-module</PackageTags>
<Version>0.2.0</Version>
<PackageVersion>0.2.1</PackageVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

</Project>
14 changes: 0 additions & 14 deletions modules/dictionary-management/src/Directory.Build.props

This file was deleted.

Loading

0 comments on commit 0ba9148

Please sign in to comment.