Skip to content

Commit 4db49d3

Browse files
authored
Update DataProtectionKey to use DynamicDependency (dotnet#43207)
1 parent 2d5c322 commit 4db49d3

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/DataProtection/EntityFrameworkCore/src/DataProtectionKey.cs

-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Diagnostics.CodeAnalysis;
5-
64
namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore;
75

86
/// <summary>
97
/// Code first model used by <see cref="EntityFrameworkCoreXmlRepository{TContext}"/>.
108
/// </summary>
11-
// DataProtectionKey.Id is not used anywhere. Add DynamicallyAccessedMembers to prevent it from being trimmed.
12-
// Note that in the future EF may annotate itself to include properties automatically, and the annotation here could be removed.
13-
// Fixes https://github.com/dotnet/aspnetcore/issues/43187
14-
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
159
public class DataProtectionKey
1610
{
1711
/// <summary>

src/DataProtection/EntityFrameworkCore/src/EntityFrameworkCoreXmlRepository.cs

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
using System.Linq;
56
using System.Xml.Linq;
67
using Microsoft.AspNetCore.DataProtection.Repositories;
@@ -24,6 +25,10 @@ public class EntityFrameworkCoreXmlRepository<TContext> : IXmlRepository
2425
/// </summary>
2526
/// <param name="services"></param>
2627
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
28+
// DataProtectionKey.Id is not used anywhere. Add DynamicDependency to prevent it from being trimmed.
29+
// Note that in the future EF may annotate itself to include properties automatically, and the annotation here could be removed.
30+
// Fixes https://github.com/dotnet/aspnetcore/issues/43187
31+
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(DataProtectionKey))]
2732
public EntityFrameworkCoreXmlRepository(IServiceProvider services, ILoggerFactory loggerFactory)
2833
{
2934
if (loggerFactory == null)

0 commit comments

Comments
 (0)