Skip to content

Commit e277417

Browse files
committed
- fix lint
1 parent 053316b commit e277417

File tree

6 files changed

+19
-25
lines changed

6 files changed

+19
-25
lines changed

src/TurboMapper/IObjectMap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace TurboMapper
55
internal interface IObjectMap
66
{
77
void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings = null);
8+
89
void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings, bool enableDefaultMapping);
910
}
1011
}

src/TurboMapper/Impl/Mapper.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal class MapperConfiguration
1111
{
1212
public List<PropertyMapping> Mappings { get; set; }
1313
public bool EnableDefaultMapping { get; set; }
14-
14+
1515
public MapperConfiguration(List<PropertyMapping> mappings, bool enableDefaultMapping)
1616
{
1717
Mappings = mappings ?? new List<PropertyMapping>();
@@ -38,7 +38,7 @@ public void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings = null)
3838

3939
_configurations[sourceType][targetType] = new MapperConfiguration(mappings, true);
4040
}
41-
41+
4242
public void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings, bool enableDefaultMapping)
4343
{
4444
var sourceType = typeof(TSource);
@@ -146,7 +146,7 @@ private void ApplyDefaultNameBasedMapping<TSource, TTarget>(
146146

147147
var nestedSourceValue = sourceValue;
148148
// Use reflection to call the right generic method for nested mapping
149-
var genericMethod = typeof(Mapper).GetMethod(nameof(ApplyNameBasedMapping),
149+
var genericMethod = typeof(Mapper).GetMethod(nameof(ApplyNameBasedMapping),
150150
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
151151
var specificMethod = genericMethod.MakeGenericMethod(sourceProp.PropertyType, targetProp.PropertyType);
152152
specificMethod.Invoke(this, new object[] { nestedSourceValue, nestedTargetValue });
@@ -194,7 +194,7 @@ internal void ApplyNameBasedMapping<TSource, TTarget>(TSource source, TTarget ta
194194
}
195195

196196
// Recursively map the nested object properties using reflection
197-
var genericMethod = typeof(Mapper).GetMethod(nameof(ApplyNameBasedMapping),
197+
var genericMethod = typeof(Mapper).GetMethod(nameof(ApplyNameBasedMapping),
198198
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
199199
var specificMethod = genericMethod.MakeGenericMethod(sourceProp.PropertyType, targetProp.PropertyType);
200200
specificMethod.Invoke(this, new object[] { sourceValue, nestedTargetValue });
@@ -319,13 +319,13 @@ private object ConvertValue(object value, Type targetType)
319319
// an object of one type to another (e.g., assigning Address object to AddressWithConfig property)
320320
if (IsComplexType(targetType) && value != null && !targetType.IsAssignableFrom(value.GetType()))
321321
{
322-
try
322+
try
323323
{
324324
// Use the main Map method to convert the object from one type to another
325325
var sourceType = value.GetType();
326-
var genericMapMethod = typeof(Mapper).GetMethod(nameof(Map),
326+
var genericMapMethod = typeof(Mapper).GetMethod(nameof(Map),
327327
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
328-
328+
329329
if (genericMapMethod != null)
330330
{
331331
var specificMapMethod = genericMapMethod.MakeGenericMethod(sourceType, targetType);
@@ -338,22 +338,22 @@ private object ConvertValue(object value, Type targetType)
338338
return value;
339339
}
340340
}
341-
341+
342342
return value;
343343
}
344344

345345
private object Map(object source, Type targetType)
346346
{
347347
var sourceType = source.GetType();
348348
// Get the generic Map method (TTarget Map<TSource, TTarget>(TSource source))
349-
var genericMapMethod = typeof(Mapper).GetMethod(nameof(Map),
349+
var genericMapMethod = typeof(Mapper).GetMethod(nameof(Map),
350350
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
351-
351+
352352
if (genericMapMethod == null)
353353
{
354354
throw new InvalidOperationException($"Could not find Map method for source type {sourceType}");
355355
}
356-
356+
357357
var specificMapMethod = genericMapMethod.MakeGenericMethod(sourceType, targetType);
358358
return specificMapMethod.Invoke(this, new object[] { source });
359359
}

src/TurboMapper/ServiceCollectionExtensions.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
43
using System.Linq;
54
using System.Reflection;
65
using Microsoft.Extensions.DependencyInjection;
@@ -15,7 +14,7 @@ public static IServiceCollection AddTurboMapper(
1514
{
1615
if (services == null)
1716
throw new ArgumentNullException(nameof(services));
18-
17+
1918
// Register ObjectMapper as singleton
2019
services.AddSingleton<IMapper, Mapper>(serviceProvider =>
2120
{
@@ -34,7 +33,7 @@ private static void DiscoverAndRegisterMappingModules(Mapper mapper)
3433
{
3534
// Strategy 1: Get all currently loaded assemblies
3635
var loadedAssemblies = new HashSet<Assembly>();
37-
36+
3837
try
3938
{
4039
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
@@ -63,7 +62,7 @@ private static void DiscoverAndRegisterMappingModules(Mapper mapper)
6362
{
6463
// Continue if entry assembly can't be accessed
6564
}
66-
65+
6766
try
6867
{
6968
var callingAssembly = Assembly.GetCallingAssembly();
@@ -76,7 +75,7 @@ private static void DiscoverAndRegisterMappingModules(Mapper mapper)
7675
{
7776
// Continue if calling assembly can't be accessed
7877
}
79-
78+
8079
try
8180
{
8281
var executingAssembly = Assembly.GetExecutingAssembly();
@@ -120,16 +119,16 @@ private static void DiscoverAndRegisterMappingModules(Mapper mapper)
120119
}
121120
}
122121
}
123-
122+
124123
private static List<Type> GetMappingTypesFromAssembly(Assembly assembly)
125124
{
126125
try
127126
{
128-
if (assembly.IsDynamic || assembly.GlobalAssemblyCache)
127+
if (assembly.IsDynamic || assembly.GlobalAssemblyCache)
129128
{
130129
return new List<Type>();
131130
}
132-
131+
133132
return assembly.GetTypes()
134133
.Where(t => t.IsClass && !t.IsAbstract && typeof(IMappingModule).IsAssignableFrom(t))
135134
.ToList();

tests/TurboMapper.Tests/EdgeCaseErrorhandlingTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using TurboMapper.Impl;
42

53
namespace TurboMapper.Tests

tests/TurboMapper.Tests/MapperInternalMethodsTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using TurboMapper.Impl;
42

53
namespace TurboMapper.Tests

tests/TurboMapper.Tests/ObjectMapperTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using System;
3-
using System.Collections.Generic;
42
using TurboMapper.Impl;
53

64
namespace TurboMapper.Tests

0 commit comments

Comments
 (0)