refactor: TypeFactory ReloadTypes made multithread friendly
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -6,7 +7,7 @@ namespace Syntriax.Engine.Core.Factory;
|
|||||||
|
|
||||||
public static class TypeFactory
|
public static class TypeFactory
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<string, Type> registeredTypes = [];
|
private static readonly ConcurrentDictionary<string, Type> registeredTypes = [];
|
||||||
|
|
||||||
public static string GetTypeName(Type type) => type.FullName ?? throw new ArgumentException($"{type.Name} must be a resolvable type");
|
public static string GetTypeName(Type type) => type.FullName ?? throw new ArgumentException($"{type.Name} must be a resolvable type");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user