Skip to content

Commit bc77524

Browse files
committed
5.0.0-preview022 - backtrack on some changes
1 parent f53aa5c commit bc77524

12 files changed

Lines changed: 17 additions & 43 deletions

File tree

AuthPermissions.AspNetCore/CreateNuGetDebug.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>AuthPermissions.AspNetCore</id>
5-
<version>5.0.0-preview020debug</version>
5+
<version>5.0.0-preview022debug</version>
66
<authors>Jon P Smith</authors>
77
<product>AuthPermissions.AspNetCore</product>
88
<copyright>Copyright (c) 2021 Jon P Smith</copyright>

AuthPermissions.AspNetCore/MultiProjPack.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- See documentation for all the possible values -->
55
<metadata>
66
<id>AuthPermissions.AspNetCore</id>
7-
<version>5.0.0-preview020debug</version>
7+
<version>5.0.0-preview022debug</version>
88
<authors>Jon P Smith</authors>
99
<product>AuthPermissions.AspNetCore</product>
1010
<copyright>Copyright (c) 2021 Jon P Smith</copyright>

AuthPermissions.AspNetCore/SetupExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ public static AuthSetupData SetupMultiTenantSharding(this AuthSetupData setupDat
168168
setupData.Options.Configuration.AddJsonFile(shardingFileName, optional: true, reloadOnChange: true);
169169

170170
setupData.Services.AddScoped<IAccessDatabaseInformationVer5, AccessDatabaseInformationJsonFile>();
171-
setupData.Services.AddScoped<IShardingConnections, ShardingConnectionsJsonFile>();
172-
setupData.Services.AddScoped<ILinkToTenantDataService, LinkToTenantDataService>();
171+
setupData.Services.AddTransient<IShardingConnections, ShardingConnectionsJsonFile>();
172+
setupData.Services.AddTransient<ILinkToTenantDataService, LinkToTenantDataService>();
173173

174174
switch (setupData.Options.LinkToTenantType)
175175
{

AuthPermissions.BaseCode/DatabaseInformation.cs renamed to AuthPermissions.AspNetCore/ShardingServices/DatabaseInformation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// Licensed under MIT license. See License.txt in the project root for license information.
33

44
using System.ComponentModel.DataAnnotations;
5+
using AuthPermissions.BaseCode;
56
using AuthPermissions.BaseCode.CommonCode;
67
using AuthPermissions.BaseCode.DataLayer.EfCode;
78
using AuthPermissions.BaseCode.SetupCode;
8-
using Microsoft.EntityFrameworkCore;
99

10-
namespace AuthPermissions.BaseCode;
10+
namespace AuthPermissions.AspNetCore.ShardingServices;
1111

1212
/// <summary>
1313
/// This class holds the information about each database used by the AuthP sharding feature

AuthPermissions.BaseCode/ProviderNameExtension.cs renamed to AuthPermissions.AspNetCore/ShardingServices/ProviderNameExtension.cs

File renamed without changes.

AuthPermissions/AdminCode/ITenantChangeService.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Copyright (c) 2021 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/
22
// Licensed under MIT license. See License.txt in the project root for license information.
33

4-
using System.Collections.Generic;
5-
using System.Threading.Tasks;
64
using AuthPermissions.AdminCode.Services;
7-
using AuthPermissions.BaseCode;
85
using AuthPermissions.BaseCode.DataLayer.Classes;
96

107
namespace AuthPermissions.AdminCode
@@ -24,10 +21,8 @@ public interface ITenantChangeService
2421
/// NOTE: With hierarchical tenants you cannot be sure that the tenant has, or will have, children
2522
/// </summary>
2623
/// <param name="tenant">The tenant data used to create a new tenant</param>
27-
/// <param name="databaseInformation">Optional: If sharding and "sign up" feature you need to provide the DatabaseInformation.
28-
/// This overcomes a problem that the ShardingConnectionsJsonFile doesn't update quickly enough.</param>
2924
/// <returns>Returns null if all OK, otherwise the create is rolled back and the return string is shown to the user</returns>
30-
Task<string> CreateNewTenantAsync(Tenant tenant, DatabaseInformation databaseInformation = null);
25+
Task<string> CreateNewTenantAsync(Tenant tenant);
3126

3227
//----------------------------------------------------
3328
// Single-level only methods

Example3.InvoiceCode/EfCoreCode/InvoiceTenantChangeService.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Threading.Tasks;
88
using AuthPermissions.AdminCode;
99
using AuthPermissions.AdminCode.Services;
10+
using AuthPermissions.AspNetCore.ShardingServices;
1011
using AuthPermissions.BaseCode;
1112
using AuthPermissions.BaseCode.CommonCode;
1213
using AuthPermissions.BaseCode.DataLayer.Classes;
@@ -40,10 +41,8 @@ public InvoiceTenantChangeService(InvoicesDbContext context, ILogger<InvoiceTena
4041
/// NOTE: With hierarchical tenants you cannot be sure that the tenant has, or will have, children
4142
/// </summary>
4243
/// <param name="tenant">The tenant data used to create a new tenant</param>
43-
/// <param name="databaseInformation">Optional: If sharding and "sign up" feature you need to provide the DatabaseInformation.
44-
/// This overcomes a problem that the ShardingConnectionsJsonFile doesn't update quickly enough.</param>
4544
/// <returns>Returns null if all OK, otherwise the create is rolled back and the return string is shown to the user</returns>
46-
public async Task<string> CreateNewTenantAsync(Tenant tenant, DatabaseInformation databaseInformation = null)
45+
public async Task<string> CreateNewTenantAsync(Tenant tenant)
4746
{
4847
var newCompanyTenant = new CompanyTenant
4948
{

Example4.ShopCode/EfCoreCode/RetailTenantChangeService.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Threading.Tasks;
99
using AuthPermissions.AdminCode;
1010
using AuthPermissions.AdminCode.Services;
11+
using AuthPermissions.AspNetCore.ShardingServices;
1112
using AuthPermissions.BaseCode;
1213
using AuthPermissions.BaseCode.CommonCode;
1314
using AuthPermissions.BaseCode.DataLayer.Classes;
@@ -37,10 +38,8 @@ public RetailTenantChangeService(RetailDbContext context, ILogger<RetailTenantCh
3738
/// NOTE: With hierarchical tenants you cannot be sure that the tenant has, or will have, children so we always add a retail
3839
/// </summary>
3940
/// <param name="tenant">The tenant data used to create a new tenant</param>
40-
/// <param name="databaseInformation">Optional: If sharding and "sign up" feature you need to provide the DatabaseInformation.
41-
/// This overcomes a problem that the ShardingConnectionsJsonFile doesn't update quickly enough.</param>
4241
/// <returns>Returns null if all OK, otherwise the create is rolled back and the return string is shown to the user</returns>
43-
public async Task<string> CreateNewTenantAsync(Tenant tenant, DatabaseInformation databaseInformation = null)
42+
public async Task<string> CreateNewTenantAsync(Tenant tenant)
4443
{
4544
_context.Add(new RetailOutlet(tenant.TenantId, tenant.TenantFullName, tenant.GetTenantDataKey()));
4645
await _context.SaveChangesAsync();

Example6.MvcWebApp.Sharding/Views/Sharding/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@using AuthPermissions.BaseCode.PermissionsCode
22
@using Example6.MvcWebApp.Sharding.PermissionsCode
33
@using Microsoft.AspNetCore.Mvc.TagHelpers
4-
@model IEnumerable<AuthPermissions.BaseCode.DatabaseInformation>
4+
@model IEnumerable<AuthPermissions.AspNetCore.ShardingServices.DatabaseInformation>
55

66
@{
77
ViewData["Title"] = "Database Info";

Example6.SingleLevelSharding/EfCoreCode/ShardingTenantChangeService.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ public ShardingTenantChangeService(DbContextOptions<ShardingSingleDbContext> opt
4848
/// This creates a <see cref="CompanyTenant"/> in the given database
4949
/// </summary>
5050
/// <param name="tenant">The tenant data used to create a new tenant</param>
51-
/// <param name="databaseInformation">Optional: If sharding and "sign up" feature you need to provide the DatabaseInformation.
52-
/// This overcomes a problem that the ShardingConnectionsJsonFile doesn't update quickly enough.</param>
5351
/// <returns>Returns null if all OK, otherwise the create is rolled back and the return string is shown to the user</returns>
54-
public async Task<string> CreateNewTenantAsync(Tenant tenant, DatabaseInformation databaseInformation = null)
52+
public async Task<string> CreateNewTenantAsync(Tenant tenant)
5553
{
5654
using var context = GetShardingSingleDbContext(tenant.DatabaseInfoName, tenant.GetTenantDataKey());
5755
if (context == null)

0 commit comments

Comments
 (0)