diff --git a/CHANGELOG.md b/CHANGELOG.md index ae43915d..cf15f234 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.5.0] - 2023-10-19 + +### Added + +- Added dotnet trimming support. + ## [1.4.0] - 2023-10-12 ### Added diff --git a/src/Microsoft.Kiota.Abstractions.csproj b/src/Microsoft.Kiota.Abstractions.csproj index 1e67b7f8..bdba8831 100644 --- a/src/Microsoft.Kiota.Abstractions.csproj +++ b/src/Microsoft.Kiota.Abstractions.csproj @@ -6,7 +6,7 @@ © Microsoft Corporation. All rights reserved. Kiota Abstractions Library for dotnet Microsoft - netstandard2.0;netstandard2.1; + netstandard2.0;netstandard2.1;net5.0; latest true http://go.microsoft.com/fwlink/?LinkID=288890 @@ -14,7 +14,7 @@ https://aka.ms/kiota/docs true true - 1.4.0 + 1.5.0 true false @@ -33,7 +33,8 @@ true LICENSE README.md - $(NoWarn);NU5048 + $(NoWarn);NU5048;NETSDK1138 + true diff --git a/src/RequestInformation.cs b/src/RequestInformation.cs index 9e08d103..d3f772da 100644 --- a/src/RequestInformation.cs +++ b/src/RequestInformation.cs @@ -10,6 +10,9 @@ using System.Linq; using Microsoft.Kiota.Abstractions.Extensions; using Microsoft.Kiota.Abstractions.Serialization; +#if NET5_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif namespace Microsoft.Kiota.Abstractions { @@ -101,10 +104,14 @@ public Uri URI /// Vanity method to add the query parameters to the request query parameters dictionary. /// /// The query parameters to add. - public void AddQueryParameters(object source) +#if NET5_0_OR_GREATER + public void AddQueryParameters<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>(T source) +#else + public void AddQueryParameters(T source) +#endif { if(source == null) return; - foreach(var property in source.GetType() + foreach(var property in typeof(T) .GetProperties() .Select( x => ( diff --git a/src/serialization/IParseNode.cs b/src/serialization/IParseNode.cs index bf2210b6..e9628dd3 100644 --- a/src/serialization/IParseNode.cs +++ b/src/serialization/IParseNode.cs @@ -4,6 +4,9 @@ using System; using System.Collections.Generic; +#if NET5_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif namespace Microsoft.Kiota.Abstractions.Serialization { @@ -97,7 +100,11 @@ public interface IParseNode /// Gets the collection of enum values of the node. /// /// The collection of enum values. +#if NET5_0_OR_GREATER + IEnumerable GetCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>() where T : struct, Enum; +#else IEnumerable GetCollectionOfEnumValues() where T : struct, Enum; +#endif /// /// Gets the collection of model objects values of the node. /// @@ -108,7 +115,11 @@ public interface IParseNode /// Gets the enum value of the node. /// /// The enum value of the node. +#if NET5_0_OR_GREATER + T? GetEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>() where T : struct, Enum; +#else T? GetEnumValue() where T : struct, Enum; +#endif /// /// Gets the model object value of the node. /// diff --git a/src/serialization/ISerializationWriter.cs b/src/serialization/ISerializationWriter.cs index 015bacac..54f051d7 100644 --- a/src/serialization/ISerializationWriter.cs +++ b/src/serialization/ISerializationWriter.cs @@ -5,6 +5,9 @@ using System; using System.Collections.Generic; using System.IO; +#if NET5_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif namespace Microsoft.Kiota.Abstractions.Serialization { @@ -114,7 +117,11 @@ public interface ISerializationWriter : IDisposable /// /// The key to be used for the written value. May be null. /// The enum values to be written. +#if NET5_0_OR_GREATER + void WriteCollectionOfEnumValues<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]T>(string? key, IEnumerable? values) where T : struct, Enum; +#else void WriteCollectionOfEnumValues(string? key, IEnumerable? values) where T : struct, Enum; +#endif /// /// Writes the specified byte array as a base64 string to the stream with an optional given key. /// @@ -133,7 +140,11 @@ public interface ISerializationWriter : IDisposable /// /// The key to be used for the written value. May be null. /// The enum value to be written. +#if NET5_0_OR_GREATER + void WriteEnumValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(string? key, T? value) where T : struct, Enum; +#else void WriteEnumValue(string? key, T? value) where T : struct, Enum; +#endif /// /// Writes a null value for the specified key. ///