|
| 1 | +# Namespace migration guide (v5) |
| 2 | + |
| 3 | +The repository was reorganized into 11 stable namespace buckets. This is a |
| 4 | +**breaking change**: every user should update its `using` directives. The |
| 5 | +class names and method signatures themselves did not change, only the |
| 6 | +namespaces they live in. Also, one more important thing is that the namespace was changed from `DomainCommonExtensions` to `RzR.Extensions.Domain`. |
| 7 | + |
| 8 | +## Backward-compatibility shims (`_Legacy/` folder) |
| 9 | + |
| 10 | +To soften the upgrade, every old namespace still exists via auto-generated |
| 11 | +forwarder static classes under [`src/DomainCommonExtensions/_Legacy/`](../src/DomainCommonExtensions/_Legacy). |
| 12 | +Each shim type is marked `[Obsolete]` with a message telling you the new |
| 13 | +location, so existing v4 code keeps compiling but every call site lights up |
| 14 | +in your IDE pointing to its v5 replacement. |
| 15 | + |
| 16 | +## Namespace map |
| 17 | + |
| 18 | +Update old `using` directives as follows: |
| 19 | + |
| 20 | +| Old namespace | New namespace(s) | Notes | |
| 21 | +|---|---|---| |
| 22 | +| `DomainCommonExtensions.ArraysExtensions` | `RzR.Extensions.Domain.Collections`, `RzR.Extensions.Domain.Linq` | LinqExtensions split out to `Linq`; everything else → `Collections` | |
| 23 | +| `DomainCommonExtensions.Collections` (supporting types: `IndexableEnumerable`, `MutableIndexableEnumerable`, `ObservableEnumerator`, `DisposableStackCollection`, `InsensitiveCaseHashtable`) | `RzR.Extensions.Domain.Collections.Types` | Containers separated from extension methods | |
| 24 | +| `DomainCommonExtensions.CommonExtensions` | `RzR.Extensions.Domain.Async`, `RzR.Extensions.Domain.Cryptography`, `RzR.Extensions.Domain.Data`, `RzR.Extensions.Domain.Diagnostics`, `RzR.Extensions.Domain.IO`, `RzR.Extensions.Domain.Linq`, `RzR.Extensions.Domain.Primitives` | This was the catch-all; split per concern. `FilesExtensions`, `DirectoryInfoExtensions`, `MemoryStreamExtensions` → `IO`; `CryptoExtensions`, `AESEncryptionExtensions` → `Cryptography`; `ExpressionExtensions`, `PredicateBuilderExtensions` → `Linq`; `TaskExtensions`, `FuncExtensions` → `Async`; `ExceptionExtensions`, `DocumentationExtensions` → `Diagnostics`; `ExpandoObjectExtensions` → `Data`; `NumbersExtensions`, `NullExtensions`, `RandomExtensions` → `Primitives` | |
| 25 | +| `DomainCommonExtensions.CommonExtensions.Encryption` | `RzR.Extensions.Domain.Cryptography.Rsa`, `RzR.Extensions.Domain.Cryptography.Tea` | AES extensions moved up to `Cryptography` (no `.Aes` sub-namespace because it shadows `System.Security.Cryptography.Aes`) | |
| 26 | +| `DomainCommonExtensions.CommonExtensions.Reflection` | `RzR.Extensions.Domain.Reflection` | | |
| 27 | +| `DomainCommonExtensions.CommonExtensions.SystemData` | `RzR.Extensions.Domain.Data` | | |
| 28 | +| `DomainCommonExtensions.CommonExtensions.TypeParam` | `RzR.Extensions.Domain.Reflection.TypeParam` | | |
| 29 | +| `DomainCommonExtensions.ConvertExtensions.DataReader` | `RzR.Extensions.Domain.Data.DataReader` | | |
| 30 | +| `DomainCommonExtensions.DataTypeExtensions` | `RzR.Extensions.Domain.Primitives`, `RzR.Extensions.Domain.Text`, `RzR.Extensions.Domain.Diagnostics` | `StringExtensions`, `StringInjectExtension` → `Text`; `SocketExtensions` → `Diagnostics`; everything else → `Primitives` | |
| 31 | +| `DomainCommonExtensions.Helpers` | `RzR.Extensions.Domain.IO`, `RzR.Extensions.Domain.IO.Ini`, `RzR.Extensions.Domain.Async`, `RzR.Extensions.Domain.Cryptography`, `RzR.Extensions.Domain.Primitives` | `DirectoryHelper` → `IO`; `IniFileHelper` → `IO.Ini`; `TaskRunnerHelper` → `Async`; `TinyEncryptionAlgorithmHelper` → `Cryptography.Tea`; `RandomHelper` → `Primitives` | |
| 32 | +| `DomainCommonExtensions.Helpers.Internal` | `RzR.Extensions.Domain.Internal`, `RzR.Extensions.Domain.Cryptography` | `Base32EncodingHelper` → `Cryptography` (no `.Encoding` sub-namespace because it shadows `System.Text.Encoding`) | |
| 33 | +| `DomainCommonExtensions.Helpers.Internal.AnonymousSelect[.Base|.Factory]` | `RzR.Extensions.Domain.Internal.AnonymousSelect[.Base|.Factory]` | | |
| 34 | +| `DomainCommonExtensions.Resources` (`RegularExpressions`) | `RzR.Extensions.Domain.Text` | | |
| 35 | +| `DomainCommonExtensions.Resources.Enums` | `RzR.Extensions.Domain.Collections` (`OrderType`), `RzR.Extensions.Domain.Validation` (`ExceptionType`) | | |
| 36 | +| `DomainCommonExtensions.Utilities` | `RzR.Extensions.Domain.Collections`, `RzR.Extensions.Domain.Cryptography` | `EnumerateUtils`, `GeneralUtils` → `Collections`; `PasswordGenerateUtils` → `Cryptography` | |
| 37 | +| `DomainCommonExtensions.Utilities.Ensure` | `RzR.Extensions.Domain.Validation` | `DomainEnsure`, `DomainEnsureExtensions` | |
| 38 | +| `DomainCommonExtensions.Utilities.LazyLoad` | `RzR.Extensions.Domain.Async.LazyLoad` | `AsyncLazy<T>`, `AsyncExpiringLazy<T>` | |
| 39 | + |
| 40 | +`RzR.Extensions.Domain.Models` is unchanged. |
| 41 | + |
| 42 | +## How to migrate your code |
| 43 | + |
| 44 | +Use a single project-wide find-and-replace for each row in the table above. |
| 45 | +For namespaces that split, you may need to add multiple `using` directives — |
| 46 | +your IDE's "Remove and sort usings" / `dotnet format` will trim the unused |
| 47 | +ones automatically. |
| 48 | + |
| 49 | +## Folder layout |
| 50 | + |
| 51 | +The folder tree under `src/DomainCommonExtensions/` now mirrors the namespaces |
| 52 | +exactly (folder name = last segment of namespace). `.editorconfig` enforces |
| 53 | +this with `dotnet_diagnostic.IDE0130 = warning`. |
| 54 | + |
| 55 | +``` |
| 56 | +DomainCommonExtensions/ |
| 57 | +├── Async/ (TaskExtensions, FuncExtensions, TaskRunnerHelper) |
| 58 | +│ └── LazyLoad/ (AsyncLazy, AsyncExpiringLazy) |
| 59 | +├── Collections/ (Array/List/Dictionary/Queue/Hash/Concurrent... + utils) |
| 60 | +│ └── Types/ (IndexableEnumerable, ObservableEnumerator, ...) |
| 61 | +├── Cryptography/ (AES, Crypto, Base32, Password... ) |
| 62 | +│ ├── Rsa/ |
| 63 | +│ └── Tea/ (TEA + TinyEncryptionAlgorithmHelper) |
| 64 | +├── Data/ (DataReader/Record/Table, ExpandoObject) |
| 65 | +│ └── DataReader/ (To* converters) |
| 66 | +├── Diagnostics/ (Exception, Documentation, Socket) |
| 67 | +├── Internal/ (private impl details) |
| 68 | +│ └── AnonymousSelect/ |
| 69 | +├── IO/ (Files, Directory, MemoryStream) |
| 70 | +│ └── Ini/ (IniFileHelper) |
| 71 | +├── Linq/ (LinqExtensions, Expression, PredicateBuilder) |
| 72 | +├── Models/ (unchanged) |
| 73 | +├── Primitives/ (int/long/bool/byte/char/Guid/TimeSpan/Random/...) |
| 74 | +├── Reflection/ (Type/Assembly/PropertyInfo/Reflection) |
| 75 | +│ └── TypeParam/ (TypeParam* extensions) |
| 76 | +├── Text/ (StringExtensions, StringInject, RegularExpressions) |
| 77 | +└── Validation/ (DomainEnsure, ExceptionType) |
| 78 | +``` |
0 commit comments