Skip to content

Commit ba4a93f

Browse files
feat: ability to update assembly names in default partial type resolver
1 parent e24368f commit ba4a93f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/EntityDb.Common/TypeResolvers/DefaultPartialTypeResolver.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public bool TryResolveType(EnvelopeHeaders envelopeHeaders, [NotNullWhen(true)]
3838

3939
private Assembly AssemblyResolver(AssemblyName assemblyName)
4040
{
41+
if (assemblyName.Name is { } originalName && _options.Value.UpdateNames.TryGetValue(originalName, out var newName))
42+
{
43+
assemblyName.Name = newName;
44+
}
45+
4146
if (_options.Value.IgnoreVersion)
4247
{
4348
assemblyName.Version = null;

src/EntityDb.Common/TypeResolvers/DefaultPartialTypeResolverOptions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ namespace EntityDb.Common.TypeResolvers;
55
/// </summary>
66
public sealed class DefaultPartialTypeResolverOptions
77
{
8+
/// <summary>
9+
/// If you rename your assemblies, you will want to update the
10+
/// name of the assembly for type resolving purposes, at least
11+
/// until you update the data header.
12+
/// </summary>
13+
public Dictionary<string, string> UpdateNames { get; set; } = new();
14+
815
/// <summary>
916
/// If you version your assemblies, you may want to ignore the
1017
/// version of the assembly for type resolving purposes.

0 commit comments

Comments
 (0)