refactor mapping again

This commit is contained in:
TheXamlGuy
2024-01-07 19:04:24 +00:00
parent 2e8af23784
commit bc29fbc805
4 changed files with 6 additions and 10 deletions
@@ -50,11 +50,10 @@ public static class IServiceCollectionExtensions
{
if (mappingContract.GetGenericArguments() is { Length: 2 } arguments)
{
Type requestType = arguments[0];
Type responseType = arguments[1];
services.AddTransient(typeof(THandler));
services.AddTransient(responseType, provider => ((dynamic)provider.GetRequiredService<THandler>()).Handle());
services.AddTransient(responseType, provider => ((dynamic)provider.GetRequiredService<THandler>()).Map());
}
}
+3 -4
View File
@@ -1,7 +1,6 @@
namespace Hyperbar;
public interface IMappingHandler<TFrom, TTo> :
IHandler
public interface IMappingHandler<TFrom, TTo> : IHandler
{
TTo Handle();
}
TTo Map();
}
-3
View File
@@ -1,3 +0,0 @@
namespace Hyperbar;
public class Map<TFrom, TTo>;