Browse Source

Merge branch 'dev' into mvc-app-template-login-link

pull/5872/head
Yunus Emre Kalkan 6 years ago
parent
commit
5a338ac398
  1. 16
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/wwwroot/theme.js
  2. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj
  3. 11
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieOptions.cs
  4. 32
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieService.cs
  5. 12
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ICookieService.cs
  6. 80
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/abp.js
  7. 7
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
  8. 20
      framework/src/Volo.Abp.BlazoriseUI/BreadcrumbItem.cs
  9. 37
      framework/src/Volo.Abp.BlazoriseUI/Components/PageHeader.razor
  10. 29
      framework/src/Volo.Abp.BlazoriseUI/Components/PageHeader.razor.cs
  11. 2
      framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj
  12. 12
      framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/AbpMongoDbTestModule.cs
  13. 2
      framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/MongoDbFixture.cs
  14. 90
      framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Transactions/Transaction_Tests.cs
  15. 2
      modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj
  16. 12
      modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo/Abp/AuditLogging/MongoDB/AbpAuditLoggingMongoDbTestModule.cs
  17. 2
      modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo/Abp/AuditLogging/MongoDB/MongoDbFixture.cs
  18. 2
      modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj
  19. 12
      modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbTestModule.cs
  20. 2
      modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/MongoDbFixture.cs
  21. 12
      modules/blob-storing-database/test/Volo.Abp.BlobStoring.Database.MongoDB.Tests/MongoDB/BlobStoringDatabaseMongoDbTestModule.cs
  22. 2
      modules/blob-storing-database/test/Volo.Abp.BlobStoring.Database.MongoDB.Tests/MongoDB/MongoDbFixture.cs
  23. 2
      modules/blob-storing-database/test/Volo.Abp.BlobStoring.Database.MongoDB.Tests/Volo.Abp.BlobStoring.Database.MongoDB.Tests.csproj
  24. 2
      modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj
  25. 12
      modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs
  26. 2
      modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/MongoDbFixture.cs
  27. 12
      modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/CmsKitMongoDbTestModule.cs
  28. 2
      modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/MongoDbFixture.cs
  29. 2
      modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/Volo.CmsKit.MongoDB.Tests.csproj
  30. 2
      modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj
  31. 12
      modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/MongoDB/DocsMongoDBTestModule.cs
  32. 2
      modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/MongoDB/MongoDbFixture.cs
  33. 2
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj
  34. 12
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/AbpFeatureManagementMongoDbTestModule.cs
  35. 2
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/MongoDbFixture.cs
  36. 2
      modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj
  37. 12
      modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbTestModule.cs
  38. 2
      modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/MongoDbFixture.cs
  39. 2
      modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo.Abp.IdentityServer.MongoDB.Tests.csproj
  40. 12
      modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo/Abp/IdentityServer/AbpIdentityServerMongoDbTestModule.cs
  41. 2
      modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo/Abp/IdentityServer/MongoDbFixture.cs
  42. 2
      modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo.Abp.PermissionManagement.MongoDB.Tests.csproj
  43. 12
      modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbTestModule.cs
  44. 2
      modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/MongoDbFixture.cs
  45. 27
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor
  46. 15
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs
  47. 1
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/_Imports.razor
  48. 2
      modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj
  49. 12
      modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo/Abp/SettingManagement/MongoDB/AbpSettingManagementMongoDbTestModule.cs
  50. 2
      modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo/Abp/SettingManagement/MongoDB/MongoDbFixture.cs
  51. 2
      modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj
  52. 12
      modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo/Abp/TenantManagement/MongoDb/AbpTenantManagementMongoDbTestModule.cs
  53. 2
      modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo/Abp/TenantManagement/MongoDb/MongoDbFixture.cs
  54. 1
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj
  55. 7
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/index.html
  56. 2
      templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDb/MyProjectNameMongoDbFixture.cs
  57. 12
      templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDb/MyProjectNameMongoDbTestModule.cs
  58. 2
      templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj
  59. 31
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs
  60. 2
      templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDB/MongoDbFixture.cs
  61. 12
      templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDB/MyProjectNameMongoDbTestModule.cs
  62. 2
      templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj

16
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/wwwroot/theme.js

@ -1,16 +0,0 @@
$(function () {
$('.dropdown-menu a.dropdown-toggle').on('click', function (e) {
if (!$(this).next().hasClass('show')) {
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
}
var $subMenu = $(this).next(".dropdown-menu");
$subMenu.toggleClass('show');
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function (e) {
$('.dropdown-submenu .show').removeClass("show");
});
return false;
});
});

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />

11
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieOptions.cs

@ -0,0 +1,11 @@
using System;
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
public class CookieOptions
{
public DateTimeOffset? ExpireDate { get; set; }
public string Path { get; set; }
public bool Secure { get; set; }
}
}

32
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/CookieService.cs

@ -0,0 +1,32 @@
using System.Threading.Tasks;
using Microsoft.JSInterop;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
[Dependency(ReplaceServices = true)]
public class CookieService : ICookieService, ITransientDependency
{
public IJSRuntime JsRuntime { get; }
public CookieService(IJSRuntime jsRuntime)
{
JsRuntime = jsRuntime;
}
public async ValueTask SetAsync(string key, string value, CookieOptions options)
{
await JsRuntime.InvokeVoidAsync("abp.utils.setCookieValue", key, value, options?.ExpireDate?.ToString("r"), options?.Path, options?.Secure);
}
public async ValueTask<string> GetAsync(string key)
{
return await JsRuntime.InvokeAsync<string>("abp.utils.getCookieValue", key);
}
public async ValueTask DeleteAsync(string key, string path = null)
{
await JsRuntime.InvokeVoidAsync("abp.utils.deleteCookie", key);
}
}
}

12
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/ICookieService.cs

@ -0,0 +1,12 @@
using System;
using System.Threading.Tasks;
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{
public interface ICookieService
{
public ValueTask SetAsync(string key, string value, CookieOptions options = null);
public ValueTask<string> GetAsync(string key);
public ValueTask DeleteAsync(string key, string path = null);
}
}

80
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/abp.js

@ -0,0 +1,80 @@
var abp = abp || {};
(function () {
abp.utils = abp.utils || {};
/**
* Sets a cookie value for given key.
* This is a simple implementation created to be used by ABP.
* Please use a complete cookie library if you need.
* @param {string} key
* @param {string} value
* @param {string} expireDate (optional). If not specified the cookie will expire at the end of session.
* @param {string} path (optional)
* @param {bool} secure (optional)
*/
abp.utils.setCookieValue = function (key, value, expireDate, path, secure) {
var cookieValue = encodeURIComponent(key) + '=';
if (value) {
cookieValue = cookieValue + encodeURIComponent(value);
}
if (expireDate) {
cookieValue = cookieValue + "; expires=" + expireDate;
}
if (path) {
cookieValue = cookieValue + "; path=" + path;
}
if (secure) {
cookieValue = cookieValue + "; secure";
}
document.cookie = cookieValue;
};
/**
* Gets a cookie with given key.
* This is a simple implementation created to be used by ABP.
* Please use a complete cookie library if you need.
* @param {string} key
* @returns {string} Cookie value or null
*/
abp.utils.getCookieValue = function (key) {
var equalities = document.cookie.split('; ');
for (var i = 0; i < equalities.length; i++) {
if (!equalities[i]) {
continue;
}
var splitted = equalities[i].split('=');
if (splitted.length != 2) {
continue;
}
if (decodeURIComponent(splitted[0]) === key) {
return decodeURIComponent(splitted[1] || '');
}
}
return null;
};
/**
* Deletes cookie for given key.
* This is a simple implementation created to be used by ABP.
* Please use a complete cookie library if you need.
* @param {string} key
* @param {string} path (optional)
*/
abp.utils.deleteCookie = function (key, path) {
var cookieValue = encodeURIComponent(key) + '=';
cookieValue = cookieValue + "; expires=" + (new Date(new Date().getTime() - 86400000)).toUTCString();
if (path) {
cookieValue = cookieValue + "; path=" + path;
}
document.cookie = cookieValue;
}
})();

7
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

@ -184,6 +184,7 @@ namespace Volo.Abp.BlazoriseUI
protected TUpdateViewModel EditingEntity;
protected Modal CreateModal;
protected Modal EditModal;
protected List<BreadcrumbItem> BreadcrumbItems = new List<BreadcrumbItem>(2);
protected string CreatePolicyName { get; set; }
protected string UpdatePolicyName { get; set; }
@ -239,6 +240,7 @@ namespace Volo.Abp.BlazoriseUI
protected override async Task OnInitializedAsync()
{
await SetBreadcrumbItemsAsync();
await SetPermissionsAsync();
await GetEntitiesAsync();
}
@ -438,5 +440,10 @@ namespace Volo.Abp.BlazoriseUI
await AuthorizationService.CheckAsync(policyName);
}
protected virtual ValueTask SetBreadcrumbItemsAsync()
{
return ValueTask.CompletedTask;
}
}
}

20
framework/src/Volo.Abp.BlazoriseUI/BreadcrumbItem.cs

@ -0,0 +1,20 @@
using Blazorise;
namespace Volo.Abp.BlazoriseUI
{
public class BreadcrumbItem
{
public string Text { get; set; }
public object Icon { get; set; }
public string Url { get; set; }
public BreadcrumbItem(string text, string url = null, object icon = null)
{
Text = text;
Url = url;
Icon = icon;
}
}
}

37
framework/src/Volo.Abp.BlazoriseUI/Components/PageHeader.razor

@ -0,0 +1,37 @@
<Row Class="entry-row">
<Column ColumnSize="ColumnSize.IsAuto">
<h1 class="content-header-title">@Title</h1>
</Column>
@if (BreadcrumbItems.Any())
{
<Column ColumnSize="ColumnSize.IsAuto.OnWidescreen" Padding="Padding.Is0.FromLeft.OnWidescreen">
<Breadcrumb Mode="@(BreadcrumbShowCurrent ? BreadcrumbMode.Auto : BreadcrumbMode.None)">
@if (BreadcrumbShowHome)
{
<BreadcrumbItem>
<BreadcrumbLink To="/">
<Icon Name="IconName.Home" />
</BreadcrumbLink>
</BreadcrumbItem>
}
@foreach (var item in BreadcrumbItems)
{
<BreadcrumbItem>
<BreadcrumbLink To="@item.Url">
@if (item.Icon != null)
{
<Icon Name="@item.Icon" />
}
@item.Text
</BreadcrumbLink>
</BreadcrumbItem>
}
</Breadcrumb>
</Column>
}
<Column>
<Row Class="justify-content-end mx-n1">
@ChildContent
</Row>
</Column>
</Row>

29
framework/src/Volo.Abp.BlazoriseUI/Components/PageHeader.razor.cs

@ -0,0 +1,29 @@
using System.Collections.Generic;
using Blazorise;
using Microsoft.AspNetCore.Components;
namespace Volo.Abp.BlazoriseUI.Components
{
public partial class PageHeader : ComponentBase
{
[Parameter]
public string Title { get; set; }
[Parameter]
public bool BreadcrumbShowHome { get; set; } = true;
[Parameter]
public bool BreadcrumbShowCurrent { get; set; } = true;
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public List<BreadcrumbItem> BreadcrumbItems { get; set; }
public PageHeader()
{
BreadcrumbItems = new List<BreadcrumbItem>();
}
}
}

2
framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj

@ -15,7 +15,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
</ItemGroup>

12
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/AbpMongoDbTestModule.cs

@ -21,9 +21,10 @@ namespace Volo.Abp.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
@ -35,11 +36,6 @@ namespace Volo.Abp.MongoDB
options.AddDefaultRepositories<ITestAppMongoDbContext>();
options.AddRepository<City, CityRepository>();
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

90
framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Transactions/Transaction_Tests.cs

@ -0,0 +1,90 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.TestApp.Domain;
using Volo.Abp.TestApp.Testing;
using Volo.Abp.Uow;
using Xunit;
namespace Volo.Abp.MongoDB.Transactions
{
public class Transaction_Tests : TestAppTestBase<AbpMongoDbTestModule>
{
private readonly IBasicRepository<Person, Guid> _personRepository;
private readonly IUnitOfWorkManager _unitOfWorkManager;
public Transaction_Tests()
{
_personRepository = GetRequiredService<IBasicRepository<Person, Guid>>();
_unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
}
[Fact]
public async Task Should_Rollback_Transaction_When_An_Exception_Is_Thrown()
{
var personId = Guid.NewGuid();
const string exceptionMessage = "thrown to rollback the transaction!";
try
{
await WithUnitOfWorkAsync(new AbpUnitOfWorkOptions { IsTransactional = true }, async () =>
{
await _personRepository.InsertAsync(new Person(personId, "Adam", 42));
throw new Exception(exceptionMessage);
});
}
catch (Exception e) when (e.Message == exceptionMessage)
{
}
var person = await _personRepository.FindAsync(personId);
person.ShouldBeNull();
}
[Fact]
public async Task Should_Rollback_Transaction_Manually()
{
var personId = Guid.NewGuid();
await WithUnitOfWorkAsync(new AbpUnitOfWorkOptions { IsTransactional = true }, async () =>
{
_unitOfWorkManager.Current.ShouldNotBeNull();
await _personRepository.InsertAsync(new Person(personId, "Adam", 42));
await _unitOfWorkManager.Current.RollbackAsync();
});
var person = await _personRepository.FindAsync(personId);
person.ShouldBeNull();
}
[Fact]
public async Task Should_Rollback_Transaction_Manually_With_Double_DbContext_Transaction()
{
var personId = Guid.NewGuid();
var bookId = Guid.NewGuid();
using (var scope = ServiceProvider.CreateScope())
{
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
using (uowManager.Begin(new AbpUnitOfWorkOptions { IsTransactional = true }))
{
_unitOfWorkManager.Current.ShouldNotBeNull();
await _personRepository.InsertAsync(new Person(personId, "Adam", 42));
await _unitOfWorkManager.Current.SaveChangesAsync();
//Will automatically rollback since not called the Complete!
}
}
(await _personRepository.FindAsync(personId)).ShouldBeNull();
}
}
}

2
modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj

@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo/Abp/AuditLogging/MongoDB/AbpAuditLoggingMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Abp.AuditLogging.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo/Abp/AuditLogging/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.AuditLogging.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj

@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/AbpBackgroundJobsMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Abp.BackgroundJobs.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo/Abp/BackgroundJobs/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.BackgroundJobs.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

12
modules/blob-storing-database/test/Volo.Abp.BlobStoring.Database.MongoDB.Tests/MongoDB/BlobStoringDatabaseMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Abp.BlobStoring.Database.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/blob-storing-database/test/Volo.Abp.BlobStoring.Database.MongoDB.Tests/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.BlobStoring.Database.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/blob-storing-database/test/Volo.Abp.BlobStoring.Database.MongoDB.Tests/Volo.Abp.BlobStoring.Database.MongoDB.Tests.csproj

@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
<ProjectReference Include="..\..\src\Volo.Abp.BlobStoring.Database.MongoDB\Volo.Abp.BlobStoring.Database.MongoDB.csproj" />
<ProjectReference Include="..\Volo.Abp.BlobStoring.Database.TestBase\Volo.Abp.BlobStoring.Database.TestBase.csproj" />
</ItemGroup>

2
modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj

@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
<ProjectReference Include="..\..\src\Volo.Blogging.MongoDB\Volo.Blogging.MongoDB.csproj" />
<ProjectReference Include="..\Volo.Blogging.TestBase\Volo.Blogging.TestBase.csproj" />
</ItemGroup>

12
modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/BloggingMongoDBTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Blogging.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo/Blogging/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Blogging.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

12
modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/CmsKitMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.CmsKit.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.CmsKit.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/Volo.CmsKit.MongoDB.Tests.csproj

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
<ProjectReference Include="..\..\src\Volo.CmsKit.MongoDB\Volo.CmsKit.MongoDB.csproj" />
<ProjectReference Include="..\Volo.CmsKit.TestBase\Volo.CmsKit.TestBase.csproj" />
</ItemGroup>

2
modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj

@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
<ItemGroup>

12
modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/MongoDB/DocsMongoDBTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Docs.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Docs.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj

@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/AbpFeatureManagementMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Abp.FeatureManagement.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.FeatureManagement.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj

@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbTestModule.cs

@ -15,19 +15,15 @@ namespace Volo.Abp.Identity.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo/Abp/Identity/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.Identity.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo.Abp.IdentityServer.MongoDB.Tests.csproj

@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo/Abp/IdentityServer/AbpIdentityServerMongoDbTestModule.cs

@ -17,18 +17,14 @@ namespace Volo.Abp.IdentityServer
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}

2
modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo/Abp/IdentityServer/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.IdentityServer
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo.Abp.PermissionManagement.MongoDB.Tests.csproj

@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbTestModule.cs

@ -12,19 +12,15 @@ namespace Volo.Abp.PermissionManagement.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo/Abp/PermissionManagement/MongoDb/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.PermissionManagement.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

27
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor

@ -1,26 +1,9 @@
@page "/setting-management"
@using Microsoft.Extensions.Localization
@using Volo.Abp.SettingManagement.Localization
@inject IStringLocalizer<AbpSettingManagementResource> L
@inherits SettingManagementBase
@* ************************* PAGE HEADER ************************* *@
<div class="row entry-row">
<div class="col-auto">
<h1 class="content-header-title">@L["Settings"]</h1>
</div>
<div class="col-lg-auto pl-lg-0">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="~/"><i class="fa fa-home"></i> </a></li>
<li class="breadcrumb-item active" aria-current="page">@L["Settings"]</li>
</ol>
</div>
<div class="col">
<div class="text-lg-right pt-2" id="AbpContentToolbar">
</div>
</div>
</div>
<PageHeader Title="@L["Settings"]" BreadcrumbItems="@BreadcrumbItems">
</PageHeader>
<Card>
<CardBody>
@ -39,7 +22,7 @@
<TabPanel Name="@GetNormalizedString(group.Id)">
<h2>@group.DisplayName</h2>
<Divider />
@{
SettingItemRenders.Add(builder =>
{
@ -47,7 +30,7 @@
builder.CloseComponent();
});
}
@SettingItemRenders.Last()
</TabPanel>
}

15
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs

@ -3,7 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Volo.Abp.BlazoriseUI;
using Volo.Abp.SettingManagement.Localization;
namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement
{
@ -11,18 +14,21 @@ namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement
{
[Inject]
protected IServiceProvider ServiceProvider { get; set; }
protected SettingComponentCreationContext SettingComponentCreationContext { get; set; }
[Inject]
protected IOptions<SettingManagementComponentOptions> _options { get; set; }
[Inject]
protected IStringLocalizer<AbpSettingManagementResource> L { get; set; }
protected SettingManagementComponentOptions Options => _options.Value;
protected List<RenderFragment> SettingItemRenders { get; set; } = new List<RenderFragment>();
protected string SelectedGroup;
protected List<BreadcrumbItem> BreadcrumbItems = new List<BreadcrumbItem>();
protected override async Task OnInitializedAsync()
{
SettingComponentCreationContext = new SettingComponentCreationContext(ServiceProvider);
@ -31,10 +37,11 @@ namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement
{
await contributor.ConfigureAsync(SettingComponentCreationContext);
}
SettingItemRenders.Clear();
SelectedGroup = GetNormalizedString(SettingComponentCreationContext.Groups.First().Id);
BreadcrumbItems.Add(new BreadcrumbItem(L["Settings"]));
}
protected string GetNormalizedString(string value)

1
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/_Imports.razor

@ -1,5 +1,6 @@
@using Microsoft.AspNetCore.Components.Web
@using Volo.Abp.AspNetCore.Components.WebAssembly
@using Volo.Abp.BlazoriseUI
@using Volo.Abp.BlazoriseUI.Components
@using Blazorise
@using Blazorise.DataGrid

2
modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj

@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo/Abp/SettingManagement/MongoDB/AbpSettingManagementMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Abp.SettingManagement.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo/Abp/SettingManagement/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace Volo.Abp.SettingManagement.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

2
modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj

@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

12
modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo/Abp/TenantManagement/MongoDb/AbpTenantManagementMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace Volo.Abp.TenantManagement.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo/Abp/TenantManagement/MongoDb/MongoDbFixture.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.TenantManagement.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

1
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj

@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>
<ItemGroup>

7
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/wwwroot/index.html

@ -21,14 +21,9 @@
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="_content/Blazorise/blazorise.js"></script>
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js"></script>
<script src="_content/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/theme.js"></script>
<script src="_content/Volo.Abp.AspNetCore.Components.WebAssembly/abp.js"></script>
</body>
</html>

2
templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDb/MyProjectNameMongoDbFixture.cs

@ -10,7 +10,7 @@ namespace MyCompanyName.MyProjectName.MongoDB
static MyProjectNameMongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

12
templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDb/MyProjectNameMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace MyCompanyName.MyProjectName.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MyProjectNameMongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj

@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
</ItemGroup>
</Project>

31
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/IdentityServer/IdentityServerDataSeedContributor.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using IdentityServer4.Models;
@ -7,8 +7,8 @@ using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.IdentityServer.ApiScopes;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.ApiScopes;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.PermissionManagement;
@ -52,10 +52,15 @@ namespace MyCompanyName.MyProjectName.IdentityServer
{
await _identityResourceDataSeeder.CreateStandardResourcesAsync();
await CreateApiResourcesAsync();
await CreateApiScopeAsync();
await CreateApiScopesAsync();
await CreateClientsAsync();
}
private async Task CreateApiScopesAsync()
{
await CreateApiScopeAsync("MyProjectName");
}
private async Task CreateApiResourcesAsync()
{
var commonApiUserClaims = new[]
@ -97,13 +102,22 @@ namespace MyCompanyName.MyProjectName.IdentityServer
return await _apiResourceRepository.UpdateAsync(apiResource);
}
private async Task CreateApiScopeAsync()
private async Task<ApiScope> CreateApiScopeAsync(string name)
{
var apiScope = await _apiScopeRepository.GetByNameAsync("MyProjectName");
var apiScope = await _apiScopeRepository.GetByNameAsync(name);
if (apiScope == null)
{
await _apiScopeRepository.InsertAsync(new ApiScope(_guidGenerator.Create(), "MyProjectName", "MyProjectName API"), autoSave: true);
apiScope = await _apiScopeRepository.InsertAsync(
new ApiScope(
_guidGenerator.Create(),
name,
name + " API"
),
autoSave: true
);
}
return apiScope;
}
private async Task CreateClientsAsync()
@ -116,7 +130,6 @@ namespace MyCompanyName.MyProjectName.IdentityServer
"role",
"phone",
"address",
"MyProjectName"
};
@ -134,7 +147,7 @@ namespace MyCompanyName.MyProjectName.IdentityServer
await CreateClientAsync(
name: webClientId,
scopes: commonScopes,
grantTypes: new[] {"hybrid"},
grantTypes: new[] { "hybrid" },
secret: (configurationSection["MyProjectName_Web:ClientSecret"] ?? "1q2w3e*").Sha256(),
redirectUri: $"{webClientRootUrl}signin-oidc",
postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc",
@ -166,12 +179,10 @@ namespace MyCompanyName.MyProjectName.IdentityServer
grantTypes: new[] { "authorization_code" },
secret: configurationSection["MyProjectName_Blazor:ClientSecret"]?.Sha256(),
requireClientSecret: false,
requirePkce: true,
redirectUri: $"{blazorRootUrl}/authentication/login-callback",
postLogoutRedirectUri: $"{blazorRootUrl}/authentication/logout-callback"
);
}
}
private async Task<Client> CreateClientAsync(

2
templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDB/MongoDbFixture.cs

@ -10,7 +10,7 @@ namespace MyCompanyName.MyProjectName.MongoDB
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start();
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20);
ConnectionString = MongoDbRunner.ConnectionString;
}

12
templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MongoDB/MyProjectNameMongoDbTestModule.cs

@ -13,19 +13,15 @@ namespace MyCompanyName.MyProjectName.MongoDB
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");
var stringArray = MongoDbFixture.ConnectionString.Split('?');
var connectionString = stringArray[0].EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N") + "/?" + stringArray[1];
Configure<AbpDbConnectionOptions>(options =>
{
options.ConnectionStrings.Default = connectionString;
});
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
}
}
}

2
templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Mongo2Go" Version="2.2.12" />
<PackageReference Include="Mongo2Go" Version="2.2.14" />
<ProjectReference Include="..\..\src\MyCompanyName.MyProjectName.MongoDB\MyCompanyName.MyProjectName.MongoDB.csproj" />
<ProjectReference Include="..\MyCompanyName.MyProjectName.TestBase\MyCompanyName.MyProjectName.TestBase.csproj" />
</ItemGroup>

Loading…
Cancel
Save