diff --git a/BenjaminAbt.StrongOf.sln b/BenjaminAbt.StrongOf.sln index 12539f5..95bd973 100644 --- a/BenjaminAbt.StrongOf.sln +++ b/BenjaminAbt.StrongOf.sln @@ -1,11 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.9.34321.82 +VisualStudioVersion = 17.9.34407.89 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9C7B03D7-E313-47EB-8A4F-BF442956D829}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{23C114B9-080A-47BC-9FE7-673E1E0B9856}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{5EBC22E6-E051-418E-BC9D-9B74F17A2F4E}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{C087DEB7-775E-41AA-A635-7961034570DC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{E5C09263-101F-497B-86CD-AF3CCB277F43}" + ProjectSection(SolutionItems) = preProject + .github\workflows\ci.yml = .github\workflows\ci.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{5DB2BFC3-D691-4081-855D-744D50C9EEF2}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitignore = .gitignore @@ -18,96 +25,63 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{5EBC22E6-E051-41 version.json = version.json EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf", "src\StrongOf\StrongOf.csproj", "{78DBB3DD-B458-4E49-AA26-2577AE8D42D2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf", "src\StrongOf\StrongOf.csproj", "{72893F62-1AD7-46A0-8F97-F813119685FE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.UnitTests", "tests\StrongOf.UnitTests\StrongOf.UnitTests.csproj", "{2B65669D-D89E-43BF-AED2-040901AD5DDE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.AspNetCore", "src\StrongOf.AspNetCore\StrongOf.AspNetCore.csproj", "{0158837D-1931-445E-B8B4-60144B4ED9D6}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{B7F77EA5-DBD1-497B-9EFF-57A77B417C05}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.Json", "src\StrongOf.Json\StrongOf.Json.csproj", "{38C2CAEF-282A-4DB8-BD46-90C93EA8CD10}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.Json", "src\StrongOf.Json\StrongOf.Json.csproj", "{E66A4B68-E1DC-451D-994E-62CF264105F4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.Json.UnitTests", "tests\StrongOf.Json.UnitTests\StrongOf.Json.UnitTests.csproj", "{D77A2C90-177F-4136-99F8-9BFCF903B289}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{C3006364-ACCB-414B-AF93-FCB073172D2C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.UnitTests", "tests\StrongOf.UnitTests\StrongOf.UnitTests.csproj", "{0C62481D-5C5E-4F78-BB26-8477F0FD8AE4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.Benchmarks", "perf\StrongOf.Benchmarks\StrongOf.Benchmarks.csproj", "{037BD880-B026-4651-8AF0-6487D37B0247}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.Json.UnitTests", "tests\StrongOf.Json.UnitTests\StrongOf.Json.UnitTests.csproj", "{BE1CA873-610A-4676-80F5-0B4203792DFA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{DB3E9CDF-6977-4CF7-AA45-B57CFDD8C6E1}" - ProjectSection(SolutionItems) = preProject - .github\workflows\ci.yml = .github\workflows\ci.yml - EndProjectSection +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "perf", "perf", "{4AAB4675-C1B3-49E1-87DA-72E66D8AF90C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.AspNetCore", "src\StrongOf.AspNetCore\StrongOf.AspNetCore.csproj", "{B866713A-B5F2-4ED3-B063-AB05C9122766}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongOf.Benchmarks", "perf\StrongOf.Benchmarks\StrongOf.Benchmarks.csproj", "{DAC3D916-3080-473A-8F9C-7556B9D9BBFC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Debug|x64.ActiveCfg = Debug|x64 - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Debug|x64.Build.0 = Debug|x64 - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Release|Any CPU.Build.0 = Release|Any CPU - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Release|x64.ActiveCfg = Release|x64 - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2}.Release|x64.Build.0 = Release|x64 - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Debug|x64.ActiveCfg = Debug|x64 - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Debug|x64.Build.0 = Debug|x64 - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Release|Any CPU.Build.0 = Release|Any CPU - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Release|x64.ActiveCfg = Release|x64 - {2B65669D-D89E-43BF-AED2-040901AD5DDE}.Release|x64.Build.0 = Release|x64 - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Debug|x64.ActiveCfg = Debug|x64 - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Debug|x64.Build.0 = Debug|x64 - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Release|Any CPU.Build.0 = Release|Any CPU - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Release|x64.ActiveCfg = Release|x64 - {E66A4B68-E1DC-451D-994E-62CF264105F4}.Release|x64.Build.0 = Release|x64 - {037BD880-B026-4651-8AF0-6487D37B0247}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {037BD880-B026-4651-8AF0-6487D37B0247}.Debug|Any CPU.Build.0 = Debug|Any CPU - {037BD880-B026-4651-8AF0-6487D37B0247}.Debug|x64.ActiveCfg = Debug|x64 - {037BD880-B026-4651-8AF0-6487D37B0247}.Debug|x64.Build.0 = Debug|x64 - {037BD880-B026-4651-8AF0-6487D37B0247}.Release|Any CPU.ActiveCfg = Release|Any CPU - {037BD880-B026-4651-8AF0-6487D37B0247}.Release|Any CPU.Build.0 = Release|Any CPU - {037BD880-B026-4651-8AF0-6487D37B0247}.Release|x64.ActiveCfg = Release|x64 - {037BD880-B026-4651-8AF0-6487D37B0247}.Release|x64.Build.0 = Release|x64 - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Debug|x64.ActiveCfg = Debug|x64 - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Debug|x64.Build.0 = Debug|x64 - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Release|Any CPU.Build.0 = Release|Any CPU - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Release|x64.ActiveCfg = Release|x64 - {BE1CA873-610A-4676-80F5-0B4203792DFA}.Release|x64.Build.0 = Release|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Debug|Any CPU.ActiveCfg = Debug|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Debug|Any CPU.Build.0 = Debug|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Debug|x64.ActiveCfg = Debug|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Debug|x64.Build.0 = Debug|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Release|Any CPU.ActiveCfg = Release|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Release|Any CPU.Build.0 = Release|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Release|x64.ActiveCfg = Release|x64 - {B866713A-B5F2-4ED3-B063-AB05C9122766}.Release|x64.Build.0 = Release|x64 + {72893F62-1AD7-46A0-8F97-F813119685FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72893F62-1AD7-46A0-8F97-F813119685FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72893F62-1AD7-46A0-8F97-F813119685FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72893F62-1AD7-46A0-8F97-F813119685FE}.Release|Any CPU.Build.0 = Release|Any CPU + {0158837D-1931-445E-B8B4-60144B4ED9D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0158837D-1931-445E-B8B4-60144B4ED9D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0158837D-1931-445E-B8B4-60144B4ED9D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0158837D-1931-445E-B8B4-60144B4ED9D6}.Release|Any CPU.Build.0 = Release|Any CPU + {38C2CAEF-282A-4DB8-BD46-90C93EA8CD10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38C2CAEF-282A-4DB8-BD46-90C93EA8CD10}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38C2CAEF-282A-4DB8-BD46-90C93EA8CD10}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38C2CAEF-282A-4DB8-BD46-90C93EA8CD10}.Release|Any CPU.Build.0 = Release|Any CPU + {D77A2C90-177F-4136-99F8-9BFCF903B289}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D77A2C90-177F-4136-99F8-9BFCF903B289}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D77A2C90-177F-4136-99F8-9BFCF903B289}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D77A2C90-177F-4136-99F8-9BFCF903B289}.Release|Any CPU.Build.0 = Release|Any CPU + {0C62481D-5C5E-4F78-BB26-8477F0FD8AE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C62481D-5C5E-4F78-BB26-8477F0FD8AE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C62481D-5C5E-4F78-BB26-8477F0FD8AE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C62481D-5C5E-4F78-BB26-8477F0FD8AE4}.Release|Any CPU.Build.0 = Release|Any CPU + {DAC3D916-3080-473A-8F9C-7556B9D9BBFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAC3D916-3080-473A-8F9C-7556B9D9BBFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAC3D916-3080-473A-8F9C-7556B9D9BBFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAC3D916-3080-473A-8F9C-7556B9D9BBFC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {78DBB3DD-B458-4E49-AA26-2577AE8D42D2} = {9C7B03D7-E313-47EB-8A4F-BF442956D829} - {2B65669D-D89E-43BF-AED2-040901AD5DDE} = {B7F77EA5-DBD1-497B-9EFF-57A77B417C05} - {E66A4B68-E1DC-451D-994E-62CF264105F4} = {9C7B03D7-E313-47EB-8A4F-BF442956D829} - {037BD880-B026-4651-8AF0-6487D37B0247} = {C3006364-ACCB-414B-AF93-FCB073172D2C} - {BE1CA873-610A-4676-80F5-0B4203792DFA} = {B7F77EA5-DBD1-497B-9EFF-57A77B417C05} - {B866713A-B5F2-4ED3-B063-AB05C9122766} = {9C7B03D7-E313-47EB-8A4F-BF442956D829} + {72893F62-1AD7-46A0-8F97-F813119685FE} = {23C114B9-080A-47BC-9FE7-673E1E0B9856} + {0158837D-1931-445E-B8B4-60144B4ED9D6} = {23C114B9-080A-47BC-9FE7-673E1E0B9856} + {38C2CAEF-282A-4DB8-BD46-90C93EA8CD10} = {23C114B9-080A-47BC-9FE7-673E1E0B9856} + {D77A2C90-177F-4136-99F8-9BFCF903B289} = {C087DEB7-775E-41AA-A635-7961034570DC} + {0C62481D-5C5E-4F78-BB26-8477F0FD8AE4} = {C087DEB7-775E-41AA-A635-7961034570DC} + {DAC3D916-3080-473A-8F9C-7556B9D9BBFC} = {4AAB4675-C1B3-49E1-87DA-72E66D8AF90C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9C4C28DB-6C18-4282-8DCE-305E3746B6AC} + SolutionGuid = {596765F3-28D7-480C-9E4C-03DDD9F0F82C} EndGlobalSection EndGlobal diff --git a/README.md b/README.md index 5ea6f39..1ad9677 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,11 @@ The frequent problem in code implementation is that values are not given any mea ```csharp public class User { - public Tenant TenantId { get; set; } - public Guid UserId { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string Email { get; set; } + public Guid TenantId { get; set; } + public Guid UserId { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } } ``` @@ -35,19 +35,19 @@ public User AddUser(Guid tenantId, Guid userId, string firstName, string lastNam The idea is to use a domain-driven design approach to give specific values a meaning through their own types. ```csharp -private sealed class TenantId(Guid value) : StrongGuid(value) { } -private sealed class UserId(Guid value) : StrongGuid(value) { } +private sealed class TenantId(Guid value) : StrongGuid(value) { } +private sealed class UserId(Guid value) : StrongGuid(value) { } private sealed class FirstName(string value) : StrongString(value) { } -private sealed class LastName(string value) : StrongString(value) { } -private sealed class Email(string value) : StrongString(value) { } +private sealed class LastName(string value) : StrongString(value) { } +private sealed class Email(string value) : StrongString(value) { } public class User { - public TenantId TenantId { get; set; } - public UserId UserId { get; set; } - public FirstName FirstName { get; set; } - public LastName LastName { get; set; } - public Email Email { get; set; } + public TenantId TenantId { get; set; } + public UserId UserId { get; set; } + public FirstName FirstName { get; set; } + public LastName LastName { get; set; } + public Email Email { get; set; } } // with compiler warning if you mess up the order here @@ -119,7 +119,7 @@ public class MyBinderProvider : IModelBinderProvider You can also create a customized binder ```csharp -public class MyCustonStrongGuidBinder : StrongOfBinder +public class MyCustomStrongGuidBinder : StrongOfBinder where TStrong : StrongGuid { public override bool TryHandle(string value, out ModelBindingResult result)