From 00bef1f81bff58bce396ae404820c4a894592461 Mon Sep 17 00:00:00 2001 From: Laurent le Beau-Martin Date: Tue, 9 Jan 2018 14:29:25 -0500 Subject: [PATCH] Merge LinkIt.Conventions into LinkIt Since LinkIt.Conventions is always packaged with LinkIt, might as well merge them; it makes NuGet generation easier. --- .../LinkIt.Conventions.Tests.csproj | 1 - LinkIt.Conventions/LinkIt.Conventions.csproj | 12 ---------- LinkIt.Samples/LinkIt.Samples.csproj | 1 - LinkIt.sln | 16 +------------ .../ApplyLoadLinkConventionCommand.cs | 2 +- .../Conventions}/ConventionMatch.cs | 0 ...yNullableValueTypeIdWhenIdSuffixMatches.cs | 0 .../LoadLinkExpressionConvention.cs | 0 ...tedLinkedSourceFromModelWhenNameMatches.cs | 6 ++--- .../LoadLinkMultiValueWhenIdSuffixMatches.cs | 0 ...tedLinkedSourceFromModelWhenNameMatches.cs | 6 ++--- .../LoadLinkSingleValueWhenIdSuffixMatches.cs | 0 .../FindAllConventionMatchesQuery.cs | 2 +- .../Conventions}/FuncGenerator.cs | 0 .../IByNullableValueTypeIdConvention.cs | 0 .../ILoadLinkExpressionConvention.cs | 0 .../Interfaces/IMultiValueConvention.cs | 0 .../Interfaces/ISingleValueConvention.cs | 0 .../LoadLinkProtocolBuilderExtensions.cs | 4 ++-- .../Conventions}/PropertyInfoExtensions.cs | 0 LinkIt/LinkIt.csproj | 23 +++++++++---------- 21 files changed, 22 insertions(+), 51 deletions(-) delete mode 100644 LinkIt.Conventions/LinkIt.Conventions.csproj rename {LinkIt.Conventions => LinkIt/Conventions}/ApplyLoadLinkConventionCommand.cs (98%) rename {LinkIt.Conventions => LinkIt/Conventions}/ConventionMatch.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/DefaultConventions/LoadLinkByNullableValueTypeIdWhenIdSuffixMatches.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/DefaultConventions/LoadLinkExpressionConvention.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs (86%) rename {LinkIt.Conventions => LinkIt/Conventions}/DefaultConventions/LoadLinkMultiValueWhenIdSuffixMatches.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs (83%) rename {LinkIt.Conventions => LinkIt/Conventions}/DefaultConventions/LoadLinkSingleValueWhenIdSuffixMatches.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/FindAllConventionMatchesQuery.cs (97%) rename {LinkIt.Conventions => LinkIt/Conventions}/FuncGenerator.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/Interfaces/IByNullableValueTypeIdConvention.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/Interfaces/ILoadLinkExpressionConvention.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/Interfaces/IMultiValueConvention.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/Interfaces/ISingleValueConvention.cs (100%) rename {LinkIt.Conventions => LinkIt/Conventions}/LoadLinkProtocolBuilderExtensions.cs (94%) rename {LinkIt.Conventions => LinkIt/Conventions}/PropertyInfoExtensions.cs (100%) diff --git a/LinkIt.Conventions.Tests/LinkIt.Conventions.Tests.csproj b/LinkIt.Conventions.Tests/LinkIt.Conventions.Tests.csproj index 980ea06..08faeac 100644 --- a/LinkIt.Conventions.Tests/LinkIt.Conventions.Tests.csproj +++ b/LinkIt.Conventions.Tests/LinkIt.Conventions.Tests.csproj @@ -14,7 +14,6 @@ - diff --git a/LinkIt.Conventions/LinkIt.Conventions.csproj b/LinkIt.Conventions/LinkIt.Conventions.csproj deleted file mode 100644 index 3111a62..0000000 --- a/LinkIt.Conventions/LinkIt.Conventions.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netstandard2.0 - latest - - - - - - - diff --git a/LinkIt.Samples/LinkIt.Samples.csproj b/LinkIt.Samples/LinkIt.Samples.csproj index 397b127..fc55b3b 100644 --- a/LinkIt.Samples/LinkIt.Samples.csproj +++ b/LinkIt.Samples/LinkIt.Samples.csproj @@ -16,7 +16,6 @@ - diff --git a/LinkIt.sln b/LinkIt.sln index ae1e8a1..56954ad 100644 --- a/LinkIt.sln +++ b/LinkIt.sln @@ -6,13 +6,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkIt", "LinkIt\LinkIt.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkIt.Tests", "LinkIt.Tests\LinkIt.Tests.csproj", "{A126FAF0-B945-42F1-9267-766E67C92825}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkIt.Conventions", "LinkIt.Conventions\LinkIt.Conventions.csproj", "{7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkIt.Conventions.Tests", "LinkIt.Conventions.Tests\LinkIt.Conventions.Tests.csproj", "{7A97AB8A-D206-4F8F-8FE9-F4FE87C7BD07}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkIt.Samples", "LinkIt.Samples\LinkIt.Samples.csproj", "{6AACAD49-8DDE-44F5-88F8-73E13684B285}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkIt.TestHelpers", "LinkIt.TestHelpers\LinkIt.TestHelpers.csproj", "{542CCDDC-59EF-45C7-973B-FDD4A1F30A7E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LinkIt.TestHelpers", "LinkIt.TestHelpers\LinkIt.TestHelpers.csproj", "{542CCDDC-59EF-45C7-973B-FDD4A1F30A7E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -47,18 +45,6 @@ Global {A126FAF0-B945-42F1-9267-766E67C92825}.Release|x64.Build.0 = Release|Any CPU {A126FAF0-B945-42F1-9267-766E67C92825}.Release|x86.ActiveCfg = Release|Any CPU {A126FAF0-B945-42F1-9267-766E67C92825}.Release|x86.Build.0 = Release|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Debug|x64.ActiveCfg = Debug|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Debug|x64.Build.0 = Debug|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Debug|x86.ActiveCfg = Debug|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Debug|x86.Build.0 = Debug|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Release|Any CPU.Build.0 = Release|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Release|x64.ActiveCfg = Release|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Release|x64.Build.0 = Release|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Release|x86.ActiveCfg = Release|Any CPU - {7D6C1E09-BDF9-45BB-A7E6-6E110AFC0250}.Release|x86.Build.0 = Release|Any CPU {7A97AB8A-D206-4F8F-8FE9-F4FE87C7BD07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7A97AB8A-D206-4F8F-8FE9-F4FE87C7BD07}.Debug|Any CPU.Build.0 = Debug|Any CPU {7A97AB8A-D206-4F8F-8FE9-F4FE87C7BD07}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/LinkIt.Conventions/ApplyLoadLinkConventionCommand.cs b/LinkIt/Conventions/ApplyLoadLinkConventionCommand.cs similarity index 98% rename from LinkIt.Conventions/ApplyLoadLinkConventionCommand.cs rename to LinkIt/Conventions/ApplyLoadLinkConventionCommand.cs index 76e6991..2b4eed9 100644 --- a/LinkIt.Conventions/ApplyLoadLinkConventionCommand.cs +++ b/LinkIt/Conventions/ApplyLoadLinkConventionCommand.cs @@ -43,7 +43,7 @@ private void ApplyConvention(ConventionMatch match) string.Format( "The convention \"{0}\" failed for Apply. Link target id: {1}, linked source model property: {2}", match.Convention.Name, - match.LinkTargetProperty.GetFullName(), + PropertyInfoExtensions.GetFullName(match.LinkTargetProperty), match.LinkedSourceModelProperty.Name ), ex.InnerException diff --git a/LinkIt.Conventions/ConventionMatch.cs b/LinkIt/Conventions/ConventionMatch.cs similarity index 100% rename from LinkIt.Conventions/ConventionMatch.cs rename to LinkIt/Conventions/ConventionMatch.cs diff --git a/LinkIt.Conventions/DefaultConventions/LoadLinkByNullableValueTypeIdWhenIdSuffixMatches.cs b/LinkIt/Conventions/DefaultConventions/LoadLinkByNullableValueTypeIdWhenIdSuffixMatches.cs similarity index 100% rename from LinkIt.Conventions/DefaultConventions/LoadLinkByNullableValueTypeIdWhenIdSuffixMatches.cs rename to LinkIt/Conventions/DefaultConventions/LoadLinkByNullableValueTypeIdWhenIdSuffixMatches.cs diff --git a/LinkIt.Conventions/DefaultConventions/LoadLinkExpressionConvention.cs b/LinkIt/Conventions/DefaultConventions/LoadLinkExpressionConvention.cs similarity index 100% rename from LinkIt.Conventions/DefaultConventions/LoadLinkExpressionConvention.cs rename to LinkIt/Conventions/DefaultConventions/LoadLinkExpressionConvention.cs diff --git a/LinkIt.Conventions/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs b/LinkIt/Conventions/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs similarity index 86% rename from LinkIt.Conventions/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs rename to LinkIt/Conventions/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs index bcd91cc..3f369e5 100644 --- a/LinkIt.Conventions/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs +++ b/LinkIt/Conventions/DefaultConventions/LoadLinkMultiValueNestedLinkedSourceFromModelWhenNameMatches.cs @@ -25,9 +25,9 @@ public bool DoesApply(PropertyInfo linkedSourceModelProperty, PropertyInfo linkT var sourceListItemType = linkedSourceModelProperty.PropertyType.GenericTypeArguments.Single(); var linkTargetListItemType = linkTargetProperty.PropertyType.GenericTypeArguments.Single(); - if (!linkTargetListItemType.DoesImplementILinkedSourceOnceAndOnlyOnce()) return false; + if (!LinkedSourceTypeExtensions.DoesImplementILinkedSourceOnceAndOnlyOnce(linkTargetListItemType)) return false; - if (linkTargetListItemType.GetLinkedSourceModelType() != sourceListItemType) return false; + if (LinkedSourceTypeExtensions.GetLinkedSourceModelType(linkTargetListItemType) != sourceListItemType) return false; return true; } @@ -39,7 +39,7 @@ public void Apply( getLinkedSourceModelProperty, getLinkTargetProperty, link => true, diff --git a/LinkIt.Conventions/DefaultConventions/LoadLinkMultiValueWhenIdSuffixMatches.cs b/LinkIt/Conventions/DefaultConventions/LoadLinkMultiValueWhenIdSuffixMatches.cs similarity index 100% rename from LinkIt.Conventions/DefaultConventions/LoadLinkMultiValueWhenIdSuffixMatches.cs rename to LinkIt/Conventions/DefaultConventions/LoadLinkMultiValueWhenIdSuffixMatches.cs diff --git a/LinkIt.Conventions/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs b/LinkIt/Conventions/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs similarity index 83% rename from LinkIt.Conventions/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs rename to LinkIt/Conventions/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs index 2ee2811..476da58 100644 --- a/LinkIt.Conventions/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs +++ b/LinkIt/Conventions/DefaultConventions/LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches.cs @@ -19,8 +19,8 @@ public class LoadLinkSingleValueNestedLinkedSourceFromModelWhenNameMatches : ISi public bool DoesApply(PropertyInfo linkedSourceModelProperty, PropertyInfo linkTargetProperty) { if (linkTargetProperty.Name != linkedSourceModelProperty.Name) return false; - if (!linkTargetProperty.PropertyType.DoesImplementILinkedSourceOnceAndOnlyOnce()) return false; - if (linkTargetProperty.PropertyType.GetLinkedSourceModelType() != linkedSourceModelProperty.PropertyType) return false; + if (!LinkedSourceTypeExtensions.DoesImplementILinkedSourceOnceAndOnlyOnce(linkTargetProperty.PropertyType)) return false; + if (LinkedSourceTypeExtensions.GetLinkedSourceModelType(linkTargetProperty.PropertyType) != linkedSourceModelProperty.PropertyType) return false; return true; } @@ -32,7 +32,7 @@ public void Apply( getLinkedSourceModelProperty, getLinkTargetProperty, link => true, diff --git a/LinkIt.Conventions/DefaultConventions/LoadLinkSingleValueWhenIdSuffixMatches.cs b/LinkIt/Conventions/DefaultConventions/LoadLinkSingleValueWhenIdSuffixMatches.cs similarity index 100% rename from LinkIt.Conventions/DefaultConventions/LoadLinkSingleValueWhenIdSuffixMatches.cs rename to LinkIt/Conventions/DefaultConventions/LoadLinkSingleValueWhenIdSuffixMatches.cs diff --git a/LinkIt.Conventions/FindAllConventionMatchesQuery.cs b/LinkIt/Conventions/FindAllConventionMatchesQuery.cs similarity index 97% rename from LinkIt.Conventions/FindAllConventionMatchesQuery.cs rename to LinkIt/Conventions/FindAllConventionMatchesQuery.cs index 538c803..b4fe757 100644 --- a/LinkIt.Conventions/FindAllConventionMatchesQuery.cs +++ b/LinkIt/Conventions/FindAllConventionMatchesQuery.cs @@ -84,7 +84,7 @@ private bool DoesConventionApply(ConventionMatch match) string.Format( "The convention \"{0}\" failed for DoesApply. Link target id: {1}, linked source model property: {2}", match.Convention.Name, - match.LinkTargetProperty.GetFullName(), + PropertyInfoExtensions.GetFullName(match.LinkTargetProperty), match.LinkedSourceModelProperty.Name ), ex diff --git a/LinkIt.Conventions/FuncGenerator.cs b/LinkIt/Conventions/FuncGenerator.cs similarity index 100% rename from LinkIt.Conventions/FuncGenerator.cs rename to LinkIt/Conventions/FuncGenerator.cs diff --git a/LinkIt.Conventions/Interfaces/IByNullableValueTypeIdConvention.cs b/LinkIt/Conventions/Interfaces/IByNullableValueTypeIdConvention.cs similarity index 100% rename from LinkIt.Conventions/Interfaces/IByNullableValueTypeIdConvention.cs rename to LinkIt/Conventions/Interfaces/IByNullableValueTypeIdConvention.cs diff --git a/LinkIt.Conventions/Interfaces/ILoadLinkExpressionConvention.cs b/LinkIt/Conventions/Interfaces/ILoadLinkExpressionConvention.cs similarity index 100% rename from LinkIt.Conventions/Interfaces/ILoadLinkExpressionConvention.cs rename to LinkIt/Conventions/Interfaces/ILoadLinkExpressionConvention.cs diff --git a/LinkIt.Conventions/Interfaces/IMultiValueConvention.cs b/LinkIt/Conventions/Interfaces/IMultiValueConvention.cs similarity index 100% rename from LinkIt.Conventions/Interfaces/IMultiValueConvention.cs rename to LinkIt/Conventions/Interfaces/IMultiValueConvention.cs diff --git a/LinkIt.Conventions/Interfaces/ISingleValueConvention.cs b/LinkIt/Conventions/Interfaces/ISingleValueConvention.cs similarity index 100% rename from LinkIt.Conventions/Interfaces/ISingleValueConvention.cs rename to LinkIt/Conventions/Interfaces/ISingleValueConvention.cs diff --git a/LinkIt.Conventions/LoadLinkProtocolBuilderExtensions.cs b/LinkIt/Conventions/LoadLinkProtocolBuilderExtensions.cs similarity index 94% rename from LinkIt.Conventions/LoadLinkProtocolBuilderExtensions.cs rename to LinkIt/Conventions/LoadLinkProtocolBuilderExtensions.cs index f9e3b2d..39dc3a1 100644 --- a/LinkIt.Conventions/LoadLinkProtocolBuilderExtensions.cs +++ b/LinkIt/Conventions/LoadLinkProtocolBuilderExtensions.cs @@ -68,9 +68,9 @@ public static void ApplyConventions( private static void EnsureConventionNamesAreUnique(List conventions) { - var notUniqueConventionNames = conventions.GetNotUniqueKey(convention => convention.Name); + var notUniqueConventionNames = EnumerableExtensions.GetNotUniqueKey(conventions, convention => convention.Name); - if (notUniqueConventionNames.Any()) + if (notUniqueConventionNames.Any()) throw new ArgumentException( string.Format( "Cannot have many conventions with the same name: {0}", diff --git a/LinkIt.Conventions/PropertyInfoExtensions.cs b/LinkIt/Conventions/PropertyInfoExtensions.cs similarity index 100% rename from LinkIt.Conventions/PropertyInfoExtensions.cs rename to LinkIt/Conventions/PropertyInfoExtensions.cs diff --git a/LinkIt/LinkIt.csproj b/LinkIt/LinkIt.csproj index c23abc2..f2ec742 100644 --- a/LinkIt/LinkIt.csproj +++ b/LinkIt/LinkIt.csproj @@ -3,24 +3,23 @@ netstandard2.0 latest - LinkIt.AutoMapperExtensions - LinkIt is an object-oriented data integration library that make it easy to load different kinds of objects and link them together. + LinkIt + LinkIt is an object-oriented data integration library that make it easy to load different kinds of objects and link them together. -LinkIt is not an object-relational mapping framework. It can be used for orchestrating the loading of objects and for linking the loaded objects togheter, not for defining how the objects are loaded. LinkIt is intended to be used in a variety of context such as data APIs, ETL processes, CQRS event handlers, web crawlers, etc. +LinkIt is not an object-relational mapping framework. It can be used for orchestrating the loading of objects and for linking the loaded objects togheter, not for defining how the objects are loaded. LinkIt is intended to be used in a variety of context such as data APIs, ETL processes, CQRS event handlers, web crawlers, etc. -Features -- Minimize coding effort by -- leveraging reuse and composition -- Data source independant -- Avoid the Select N + 1 problem -- Built-in support for references between complex types -- Support polymorphism out of the box -- Favor convention over configuration +Features +- Minimize coding effort by leveraging reuse and composition +- Data source independant +- Avoid the Select N + 1 problem +- Built-in support for references between complex types +- Support polymorphism out of the box +- Favor convention over configuration - Perform complex projections easily with LinkIt AutoMapper Extensions 1.1.0 Stéphane Leblanc, Laurent le Beau-Martin Radio-Canada/CBC - Copyright (c) 2015-2017 Radio-Canada/CBC + Copyright (c) 2015-2018 Radio-Canada/CBC https://raw.githubusercontent.com/cbcrc/LinkIt/master/icon.png https://github.com/cbcrc/LinkIt https://raw.githubusercontent.com/cbcrc/LinkIt/master/LICENSE.txt