You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/License-configuration.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,47 @@ There is no other license enforcement besides log messages. No central license s
30
30
31
31
The log messages are logged using standard `Microsoft.Extensions.Logging` loggers under the category name `LuckyPennySoftware.AutoMapper.License`.
32
32
33
+
### Multiple License Messages
34
+
35
+
If you see duplicate license log messages at startup, this is typically caused by AutoMapper being registered or configured more than once in your application.
36
+
37
+
#### Using `AddAutoMapper` (Microsoft.Extensions.DependencyInjection)
38
+
39
+
Calling `AddAutoMapper` multiple times in the same `IServiceCollection` is safe. After the first call registers `IMapper`, subsequent calls are ignored and no additional license validation occurs:
If you are calling `AddAutoMapper` in multiple places (e.g. in modular startup code), each call still only results in a single `MapperConfiguration` singleton and a single license log message.
47
+
48
+
#### Using `MapperConfiguration` Directly
49
+
50
+
When creating `MapperConfiguration` instances manually, each instance performs its own license validation, producing a separate log message:
51
+
52
+
```c#
53
+
// Each of these logs a license message – avoid creating multiple instances
To avoid duplicate messages, create and reuse a single `MapperConfiguration` instance for the lifetime of your application, typically registered as a singleton:
If you intentionally have multiple configurations (for example in integration tests or modular scenarios), you can silence duplicate license log messages by filtering the log category:
0 commit comments