Skip to content

Commit f71c108

Browse files
committed
final refactoring:
- drop IsConcurrencyEnvironment - all Concurrencymod property to internal
1 parent 59a9435 commit f71c108

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

src/Mapster.Tests/WhenRegisteringAndMappingRace.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public void TestCleanup()
1515
{
1616
TypeAdapterConfig.GlobalSettings.RequireExplicitMapping = false;
1717
TypeAdapterConfig.GlobalSettings.RequireDestinationMemberSource = false;
18-
TypeAdapterConfig.GlobalSettings.IsConcurrencyEnvironment = false;
1918
}
2019

2120

src/Mapster/TypeAdapterConfig.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ public class TypeAdapterConfig
1717
#region ConcurrencyMod
1818

1919
[AdaptIgnore]
20-
public AutoResetEvent ConfigureSync { get; set; }
20+
internal AutoResetEvent ConfigureSync { get; set; }
2121

2222
[AdaptIgnore]
23-
public AutoResetEvent ApplySync { get; set; }
24-
25-
public bool IsConcurrencyEnvironment { get; set; }
26-
public bool IsScanConcurrency { get; set; }
23+
internal AutoResetEvent ApplySync { get; set; }
24+
internal bool IsScanConcurrency { get; set; }
2725

2826
#endregion ConcurrencyMod
2927

@@ -810,8 +808,6 @@ public IList<IRegister> Scan(params Assembly[] assemblies)
810808

811809
public IList<IRegister> ScanConcurrency(params Assembly[] assemblies)
812810
{
813-
814-
IsConcurrencyEnvironment = true;
815811
ConfigureSync.WaitOne(-1);
816812
IsScanConcurrency = true;
817813

@@ -822,7 +818,6 @@ public IList<IRegister> ScanConcurrency(params Assembly[] assemblies)
822818
finally
823819
{
824820
ConfigureSync.Set();
825-
IsConcurrencyEnvironment = false;
826821
}
827822
}
828823

@@ -980,7 +975,6 @@ public static void NewConfig(Action<TypeAdapterSetter<TSource, TDestination>> cf
980975
{
981976
var config = TypeAdapterConfig.GlobalSettings;
982977

983-
config.IsConcurrencyEnvironment = true;
984978
config.ConfigureSync.WaitOne(-1, false);
985979

986980
try

src/Mapster/TypeAdapterSetter.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ internal static void CheckCompiled<TSetter>(this TSetter setter) where TSetter :
3131
throw new InvalidOperationException("TypeAdapter.Adapt was already called, please clone or create new TypeAdapterConfig.");
3232
}
3333

34-
public static TSetter FinalizeConfig<TSetter>(this TSetter setter) where TSetter : TypeAdapterSetter
35-
{
36-
try
37-
{
38-
setter.CheckCompiled();
39-
return setter;
40-
}
41-
finally
42-
{
43-
if (setter.Config.IsConcurrencyEnvironment)
44-
{
45-
setter.Config.ConfigureSync.Set();
46-
}
47-
48-
}
49-
}
50-
5134
public static TSetter AddDestinationTransform<TSetter, TDestinationMember>(this TSetter setter, Expression<Func<TDestinationMember, TDestinationMember>> transform) where TSetter : TypeAdapterSetter
5235
{
5336
setter.CheckCompiled();

0 commit comments

Comments
 (0)