From dde774d18e65d853ec8c1228ee6af6e3b88f9d7c Mon Sep 17 00:00:00 2001 From: "m.samson" Date: Sat, 3 Jan 2026 11:54:01 +0200 Subject: [PATCH] changed scan types to scan assembly during discovery of service --- README.md | 2 +- RELEASES.md | 5 +++++ src/CoreMap/Directory.Packages.props | 4 ++-- src/CoreMap/RegisterServiceExt.cs | 8 +++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5757607..952100c 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ internal class ArticleResponseToEntityMap : ICoreMapHandler(data.Author) + WrittenBy = alsoMap.MapEach(data.Author).To() }; } ``` diff --git a/RELEASES.md b/RELEASES.md index 28b5807..b2f2926 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,4 +1,9 @@ README: https://github.com/mshimshon/CoreMap + +# v2.0.0 +## Breaking Changes +- `AddCoreMap` `scanAssemblies` is no longer supporting Types but directly takes assemblies. + # v1.1.2 - Minor Fixes diff --git a/src/CoreMap/Directory.Packages.props b/src/CoreMap/Directory.Packages.props index 52ab580..fb2c3e6 100644 --- a/src/CoreMap/Directory.Packages.props +++ b/src/CoreMap/Directory.Packages.props @@ -1,6 +1,6 @@ - 1.1.2 - Maksim Shimshon © 2026 + 2.0.0 + Maksim Shimshon © 2026 \ No newline at end of file diff --git a/src/CoreMap/RegisterServiceExt.cs b/src/CoreMap/RegisterServiceExt.cs index 5730315..e4f9ddf 100644 --- a/src/CoreMap/RegisterServiceExt.cs +++ b/src/CoreMap/RegisterServiceExt.cs @@ -1,18 +1,20 @@ using CoreMap.Engine; using Microsoft.Extensions.DependencyInjection; +using System.Reflection; namespace CoreMap; + public static class RegisterServiceExt { - public static IServiceCollection AddCoreMap(this IServiceCollection services, Action options, Type[]? scanAssemblies = default) + public static IServiceCollection AddCoreMap(this IServiceCollection services, Action options, Assembly[]? scanAssemblies = default) { var config = new CoreMapConfiguration(); options(config); services.AddScoped(); - foreach (var assembly in scanAssemblies ?? new Type[] { }) + foreach (var assembly in scanAssemblies ?? new Assembly[] { }) { // Find all types implementing ICoreMapper<,> - var mapperTypes = assembly.Assembly.GetTypes() + var mapperTypes = assembly.GetTypes() .Where(t => !t.IsAbstract && !t.IsInterface) .SelectMany(t => t.GetInterfaces() .Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICoreMapHandler<,>))