Skip to content

Commit 8831b73

Browse files
committed
aantal reflection methods public gemaakt
1 parent f7d19a6 commit 8831b73

File tree

11 files changed

+89
-71
lines changed

11 files changed

+89
-71
lines changed

theRightDirection.Library.NetCore/Extensions/Extensions.Object.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static void CopyProperties(this object from, object to, bool includePrope
5858
if (excludedProperties != null
5959
&& excludedProperties.Contains(commonPropertyName))
6060
continue;
61-
var hasExcludeAttribute = FindAttribute(targetProperties[commonPropertyName]);
61+
var hasExcludeAttribute = FindAttribute<ExcludeFromCopyPropertyAttribute>(targetProperties[commonPropertyName]);
6262
if (!hasExcludeAttribute)
6363
{
6464
var value = sourceProperties[commonPropertyName].GetValue(from, null);
@@ -104,17 +104,22 @@ public static int GetHashCodeOnProperties(this object inspect)
104104
return inspect.GetType().GetTypeInfo().DeclaredProperties.Select(o => o.GetValue(inspect)).GetListHashCode();
105105
}
106106

107-
private static bool FindAttribute(PropertyInfo commonProperty)
107+
/// <summary>
108+
/// find the attribute on the property
109+
/// </summary>
110+
/// <typeparam name="T">the type of attribute to look for</typeparam>
111+
/// <returns>true if attribute found</returns>
112+
public static bool FindAttribute<T>(PropertyInfo commonProperty) where T:Attribute
108113
{
109-
var attribute = commonProperty.GetCustomAttribute<ExcludeFromCopyPropertyAttribute>();
114+
var attribute = commonProperty.GetCustomAttribute<T>();
110115
return attribute != null;
111116
}
112117

113118
private static Dictionary<string, PropertyInfo> GetProperties(Type type, bool recursive, bool skipListOrArrayProperties = false)
114119
{
115120
if (recursive)
116121
{
117-
Dictionary<string, PropertyInfo> properties = new Dictionary<string, PropertyInfo>();
122+
Dictionary<string, PropertyInfo> properties = new();
118123
var retrievedProperties = GetProperties(type, skipListOrArrayProperties);
119124
foreach (var retrievedProperty in retrievedProperties)
120125
{
@@ -139,7 +144,13 @@ private static Dictionary<string, PropertyInfo> GetProperties(Type type, bool re
139144
return GetProperties(type, skipListOrArrayProperties);
140145
}
141146

142-
private static Dictionary<string, PropertyInfo> GetProperties(Type type, bool skipListOrArrayProperties = false)
147+
/// <summary>
148+
/// find all properties on a type
149+
/// </summary>
150+
/// <param name="type">the type to look for properties</param>
151+
/// <param name="skipListOrArrayProperties">skip array or list properties</param>
152+
/// <returns>a dictionary with propertyName and the propertyInfo</returns>
153+
public static Dictionary<string, PropertyInfo> GetProperties(Type type, bool skipListOrArrayProperties = false)
143154
{
144155
var typeInfo = type.GetTypeInfo();
145156
Dictionary<string, PropertyInfo> properties = new Dictionary<string, PropertyInfo>();
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
5-
<AssemblyName>theRightDirection.Library</AssemblyName>
6-
<RootNamespace>theRightDirection</RootNamespace>
7-
<AssemblyVersion>2021.0.7990.0</AssemblyVersion>
8-
<FileVersion>1.2021.7990.1956</FileVersion>
9-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
10-
<Copyright>the Right Direction BV</Copyright>
11-
<PackageProjectUrl>https://www.therightdirection.nl</PackageProjectUrl>
12-
<PackageIcon>tRD-icon-v-400.jpg</PackageIcon>
13-
<Version>6.2.1</Version>
14-
<ApplicationIcon>tRD-icon-v-400.ico</ApplicationIcon>
15-
<Company>the Right Direction BV</Company>
16-
<RepositoryUrl>https://www.therightdirection.nl</RepositoryUrl>
17-
<DebugType>none</DebugType>
4+
<TargetFrameworks>net6.0</TargetFrameworks>
5+
<AssemblyName>theRightDirection.Library</AssemblyName>
6+
<RootNamespace>theRightDirection</RootNamespace>
7+
<AssemblyVersion>2022.0.2506.611</AssemblyVersion>
8+
<FileVersion>2022.0.2506.611</FileVersion>
9+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
10+
<Copyright>the Right Direction BV</Copyright>
11+
<PackageProjectUrl>https://www.therightdirection.nl</PackageProjectUrl>
12+
<PackageIcon>tRD-icon-v-400.jpg</PackageIcon>
13+
<Version>6.3.0</Version>
14+
<ApplicationIcon>tRD-icon-v-400.ico</ApplicationIcon>
15+
<Company>the Right Direction BV</Company>
16+
<RepositoryUrl>https://www.therightdirection.nl</RepositoryUrl>
17+
<DebugType>none</DebugType>
1818
</PropertyGroup>
1919

2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
21-
<OutputPath>C:\GitHub\SharedLibraries\</OutputPath>
21+
<OutputPath>C:\GitHub\SharedLibraries\</OutputPath>
2222
</PropertyGroup>
2323

2424
<ItemGroup>
25-
<Content Include="tRD-icon-v-400.ico" />
25+
<Content Include="tRD-icon-v-400.ico" />
2626
</ItemGroup>
2727

2828
<ItemGroup>
29-
<None Include="..\..\..\Users\MannusEtten\OneDrive - the Right Direction\logo &amp; templates\tRD-icon-v-400.jpg">
30-
<Pack>True</Pack>
31-
<PackagePath>\</PackagePath>
32-
</None>
29+
<None Include="..\..\..\Users\MannusEtten\OneDrive - the Right Direction\logo &amp; templates\tRD-icon-v-400.jpg">
30+
<Pack>True</Pack>
31+
<PackagePath>\</PackagePath>
32+
</None>
3333
</ItemGroup>
3434

3535
<ItemGroup>
3636
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="6.0.0" />
37-
<PackageReference Include="log4net" Version="2.0.13" />
38-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
37+
<PackageReference Include="log4net" Version="2.0.14" />
38+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
3939
</ItemGroup>
4040

4141
<ItemGroup>
42-
<Compile Update="TimeoutWebClient.cs">
43-
<SubType>Component</SubType>
44-
</Compile>
42+
<Compile Update="TimeoutWebClient.cs">
43+
<SubType>Component</SubType>
44+
</Compile>
4545
</ItemGroup>
4646
</Project>

theRightDirection.Library.UnitTesting.Core/theRightDirection.Library.UnitTesting.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
5-
<AssemblyVersion>2021.0.7990.0</AssemblyVersion>
6-
<FileVersion>1.2021.7990.1956</FileVersion>
7-
<Version>6.0.0</Version>
5+
<AssemblyVersion>2022.0.2506.611</AssemblyVersion>
6+
<FileVersion>2022.0.2506.611</FileVersion>
7+
<Version>2022.0.2506.611</Version>
88
<Company>the Right Direction BV</Company>
99
<Copyright>the Right Direction BV</Copyright>
1010
<PackageProjectUrl>https://www.therightdirection.nl</PackageProjectUrl>
@@ -27,9 +27,9 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
31-
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
32-
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
33-
<PackageReference Include="theRightDirection.Library" Version="6.0.0" />
30+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
31+
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
32+
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
33+
<PackageReference Include="theRightDirection.Library" Version="6.3.0" />
3434
</ItemGroup>
3535
</Project>

theRightDirection.Library.UnitTests/theRightDirection.Library.UnitTests.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
<Nullable>enable</Nullable>
66

77
<IsPackable>false</IsPackable>
8+
9+
<Version>2022.0.2506.611</Version>
10+
11+
<FileVersion>2022.0.2506.611</FileVersion>
812
</PropertyGroup>
913

1014
<ItemGroup>
11-
<PackageReference Include="FluentAssertions" Version="5.10.3" />
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
15+
<PackageReference Include="FluentAssertions" Version="6.7.0" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
1317
<PackageReference Include="xunit" Version="2.4.1" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
18+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1519
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1620
<PrivateAssets>all</PrivateAssets>
1721
</PackageReference>
18-
<PackageReference Include="coverlet.collector" Version="3.1.0">
22+
<PackageReference Include="coverlet.collector" Version="3.1.2">
1923
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2024
<PrivateAssets>all</PrivateAssets>
2125
</PackageReference>

theRightDirection.Tests/Library/EnumHelperTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public void Storymap()
1515
{
1616
var typeValue = "StoryMap";
1717
var enumValueIsCorrect = EnumHelper.TryParseTextToEnumValue(typeValue, out PortalItemType result);
18-
enumValueIsCorrect.Should().BeFalse();
19-
result.Should().Be(PortalItemType.ArcGISProAddIn);
18+
enumValueIsCorrect.Should().BeTrue();
19+
result.Should().Be(PortalItemType.StoryMap);
2020
}
2121

2222
[TestMethod]

theRightDirection.Tests/Library/Extension.String.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void IsValidJson()
4141
[TestMethod]
4242
public void EnterpriseUrl_Is_AlphaNumeric_And_Special_Character()
4343
{
44-
char[] chars2 = { ':' };
44+
char[] chars2 = { ':', '.' };
4545
var url = "trdgis.svwxb2emmfbudlqtj25tgxyjla.frax.internal.cloudapp.net:7443";
4646
url.IsAlphaNumeric(chars2).Should().BeTrue();
4747
}

theRightDirection.Tests/Library/SystemInformationHelperTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void WindowsVersionName()
1111
{
1212
var systemInformation = new SystemInformationHelper();
1313
var result = systemInformation.WindowsVersionName;
14-
result.Should().Be("Microsoft Windows NT 10.0.18363.0");
14+
result.Should().Be("Microsoft Windows NT 10.0.22000.0");
1515
}
1616

1717
}
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
4+
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
55

6-
<IsPackable>false</IsPackable>
6+
<IsPackable>false</IsPackable>
77

8-
<AssemblyVersion>2021.0.7990.0</AssemblyVersion>
8+
<AssemblyVersion>2022.0.2506.611</AssemblyVersion>
99

10-
<FileVersion>1.2021.7990.1956</FileVersion>
10+
<FileVersion>2022.0.2506.611</FileVersion>
11+
12+
<Version>2022.0.2506.611</Version>
1113
</PropertyGroup>
1214

1315
<ItemGroup>
14-
<PackageReference Include="Esri.ArcGISRuntime" Version="100.13.0" />
15-
<PackageReference Include="FluentAssertions" Version="6.2.0" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
17-
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
18-
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
19-
<PackageReference Include="coverlet.collector" Version="3.1.0">
20-
<PrivateAssets>all</PrivateAssets>
21-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
</PackageReference>
16+
<PackageReference Include="Esri.ArcGISRuntime" Version="100.14.1" />
17+
<PackageReference Include="FluentAssertions" Version="6.7.0" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
19+
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
20+
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
21+
<PackageReference Include="coverlet.collector" Version="3.1.2">
22+
<PrivateAssets>all</PrivateAssets>
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
</PackageReference>
2325
</ItemGroup>
2426

2527
<ItemGroup>
26-
<ProjectReference Include="..\theRightDirection.Library.NetCore\theRightDirection.Library.csproj" />
28+
<ProjectReference Include="..\theRightDirection.Library.NetCore\theRightDirection.Library.csproj" />
2729
</ItemGroup>
2830
</Project>

theRightDirection.WPF.Controls.Core/theRightDirection.WPF.Controls.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<UseWPF>true</UseWPF>
66
<RootNamespace>theRightDirection.WPF.Controls</RootNamespace>
77
<AssemblyName>theRightDirection.WPF.Controls</AssemblyName>
8-
<AssemblyVersion>2021.0.7990.0</AssemblyVersion>
9-
<FileVersion>1.2021.7990.1956</FileVersion>
8+
<AssemblyVersion>2022.0.2506.611</AssemblyVersion>
9+
<FileVersion>2022.0.2506.611</FileVersion>
1010
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
11-
<Version>6.0.0</Version>
11+
<Version>2022.0.2506.611</Version>
1212
<Company>the Right Direction</Company>
1313
<Copyright>the Right Direction BV</Copyright>
1414
<PackageProjectUrl>https://www.therightdirection.nl</PackageProjectUrl>
@@ -21,13 +21,13 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<None Include="..\..\..\Users\info\OneDrive - the Right Direction\logo &amp; templates\tRD-icon-v-400.jpg">
25-
<Pack>True</Pack>
24+
<None Include="..\..\..\Users\MannusEtten\OneDrive - the Right Direction\logo &amp; templates\tRD-icon-v-400.jpg" Link="tRD-icon-v-400.jpg">
2625
<PackagePath>\</PackagePath>
26+
<Pack>True</Pack>
2727
</None>
2828
</ItemGroup>
2929

3030
<ItemGroup>
31-
<PackageReference Include="theRightDirection.Library" Version="6.0.0" />
31+
<PackageReference Include="theRightDirection.Library" Version="6.3.0" />
3232
</ItemGroup>
3333
</Project>

theRightDirection.WPF.Controls.DemoApp/theRightDirection.WPF.Controls.DemoApp.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>net6.0-windows</TargetFramework>
66
<UseWPF>true</UseWPF>
7-
<AssemblyVersion>2021.0.7990.0</AssemblyVersion>
8-
<FileVersion>1.2021.7990.1956</FileVersion>
7+
<AssemblyVersion>2022.0.2506.611</AssemblyVersion>
8+
<FileVersion>2022.0.2506.611</FileVersion>
9+
<Version>2022.0.2506.611</Version>
910
</PropertyGroup>
1011

1112
<ItemGroup>

0 commit comments

Comments
 (0)