提交 d9306233 编写于 作者: S Sam Saffron

concurrency fix, in case we allow for deleting of caches

上级 33959b3a
......@@ -27,9 +27,11 @@ public interface IProxy
private static IEnumerable<PropertyInfo> KeyPropertiesCache(Type type)
{
if (KeyProperties.ContainsKey(type.TypeHandle))
IEnumerable<PropertyInfo> pi;
if (KeyProperties.TryGetValue(type.TypeHandle,out pi))
{
return KeyProperties[type.TypeHandle];
return pi;
}
var allProperties = TypePropertiesCache(type);
......@@ -49,9 +51,10 @@ private static IEnumerable<PropertyInfo> KeyPropertiesCache(Type type)
}
private static IEnumerable<PropertyInfo> TypePropertiesCache(Type type)
{
if (TypeProperties.ContainsKey(type.TypeHandle))
IEnumerable<PropertyInfo> pis;
if (TypeProperties.TryGetValue(type.TypeHandle, out pis))
{
return TypeProperties[type.TypeHandle];
return pis;
}
var properties = type.GetProperties();
......@@ -286,9 +289,10 @@ public static T GetInterfaceProxy<T>()
{
Type typeOfT = typeof(T);
if (TypeCache.ContainsKey(typeOfT))
object k;
if (TypeCache.TryGetValue(typeOfT, out k))
{
return (T)TypeCache[typeOfT];
return (T)k;
}
var assemblyBuilder = GetAsmBuilder(typeOfT.Name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册