|
1 | 1 | # Updating your code from AuthPermissions.AspNetCore 5.* to 6.0 |
2 | 2 |
|
3 | | -Version 6.0.0 of the AuthPermissions.AspNetCore library (shortened to **AuthP** from now on) contains improved sharding features, but they contain **BREAKING CHANGES**. There are lot of small and obvious changes, but only in AuthP's sharding features. |
| 3 | +Version 6.0.0 of the AuthPermissions.AspNetCore library (shortened to **AuthP** from now on) contains improved sharding features, but they contain **BREAKING CHANGES**. These breaking changes came about because of a limitation found in the ASP.NET Core `IOptions` feature (see this section ????). These changes ONLY EFFECT multi-tenant applications that use sharding, i.e. you have the `SetupMultiTenantSharding` extension method in your AuthP registration code. |
| 4 | + |
| 5 | +However, when I was working on the data that links tenants to databases (now called _sharding entries_) I found my previous code didn't use _nice names_. For instance: |
| 6 | + |
| 7 | +- The name of a class, method, etc didn't match what it was used for. For instance the class that links a tenant to a database was called `DatabaseInformation`, but its name is now its called `ShardingEntry`. |
| 8 | +- Some method names were too long. For instance the method that updated a `ShardingEntry` was called `UpdateDatabaseInfoToShardingInformation` and now called `UpdateShardingEntry`. |
| 9 | + |
| 10 | +Of course this creates more breaking changes, but the code will be easier to understand. Also on upgrading to AuthP 6 it will be very obvious, as each change will become an error. |
4 | 11 |
|
5 | 12 | ## TABLE OF CONTENT |
6 | 13 |
|
7 | | -1. |
| 14 | +1. Changing to the new IGetSetShardingEntries service. |
| 15 | +2. Updating the IGetSetShardingEntries method names |
| 16 | +3. Make sure that distributed FileStore Cache is registered |
| 17 | +4. Once it complies and **before you run your application** |
| 18 | + - Move your sharding entries from the json file to the distributed FileStore Cache |
8 | 19 |
|
9 | 20 | The subsections below the items listed in the table of content. |
10 | 21 |
|
| 22 | +## 1. Changing to the new [IGetSetShardingEntries](https://github.com/JonPSmith/AuthPermissions.AspNetCore/blob/main/AuthPermissions.AspNetCore/ShardingServices/IGetSetShardingEntries.cs) service |
| 23 | + |
| 24 | +Before AuthP version 6 you had two services called `IAccessDatabaseInformationVer5` and `IShardingConnections`. Now you have one service called `IGetSetShardingEntries` that contains all the methods, properties, etc. that the two services it replaces. |
| 25 | + |
| 26 | +| Old name | new name | Notes | |
| 27 | +| ----------------- | ------------- | ----- | |
| 28 | +| `IAccessDatabaseInformationVer5` | `IGetSetShardingEntries` | I use `shardingService` | |
| 29 | +| `IShardingConnections` | `IGetSetShardingEntries` | I use `shardingService` | |
| 30 | + |
| 31 | +The other big change is `IGetSetShardingEntries` changes the name of a class |
| 32 | + |
| 33 | +| Old name | new name | Notes | |
| 34 | +| ----------------- | ------------- | ----- | |
| 35 | +| `DatabaseInformation` | `ShardingEntry` | | |
| 36 | + |
| 37 | +## 2. Updating the IGetSetShardingEntries method names |
| 38 | + |
| 39 | +The table below gives the old and new. |
| 40 | +| Old name | new name | Notes | |
| 41 | +| ----------------- | ------------- | ----- | |
| 42 | +| `ReadAllShardingInformation` | `GetAllShardingEntries` | | |
| 43 | +| `GetDatabaseInformationByName` | `GetSingleShardingEntry` | | |
| 44 | +| `AddDatabaseInfoToShardingInformation` | `AddNewShardingEntry` | | |
| 45 | +| `UpdateDatabaseInfoToShardingInformation` | `UpdateShardingEntry` | | |
| 46 | +| `RemoveDatabaseInfoFromShardingInformationAsync` | `RemoveShardingEntry` | | |
| 47 | +| `GetAllPossibleShardingData` | `GetAllShardingEntries` | | |
| 48 | +| `GetDatabaseInfoNamesWithTenantNamesAsync` | `GetShardingsWithTenantNamesAsync` | | |
| 49 | + |
| 50 | +A properly that has been simplified |
| 51 | +| Old name | new name | Notes | |
| 52 | +| ----------------- | ------------- | ----- | |
| 53 | +| `ShardingDatabaseProviders.Keys.ToArray()` | `PossibleDatabaseProviders()` | | |
| 54 | + |
| 55 | +Other methods that haven't changed are listed below |
| 56 | +| Old name | new name | Notes | |
| 57 | +| ----------------- | ------------- | ----- | |
| 58 | +| `GetConnectionStringNames` | `GetConnectionStringNames` | see note1 | |
| 59 | + |
| 60 | +Note1 |
| 61 | + |
11 | 62 | END |
0 commit comments