public override object GetValue(object obj, IDictionary <string, IExtendedResourceProxy> cache) { IExtendedResourceProxy extendedResource; var underlyingResource = UnderlyingProperty.GetValue(obj, null); if (TryGetFromCache(cache, underlyingResource, out extendedResource)) { return(extendedResource); } if (underlyingResource != null) { extendedResource = (IExtendedResourceProxy) RuntimeProxyFactory.Create(typeof(ExtendedResourceBase), Property.PropertyType); var proxyBase = (ExtendedResourceBase)extendedResource; proxyBase.Initialize(ClientTypeResolver.Default, Info, underlyingResource); } else { extendedResource = null; } cache[Property.Name] = extendedResource; return(extendedResource); }
public override object GetValue(object obj, IDictionary <string, IExtendedResourceProxy> cache) { IExtendedResourceProxy extendedResource; var underlyingResource = UnderlyingProperty.GetValue(obj, null); if (TryGetFromCache(cache, underlyingResource, out extendedResource)) { return(extendedResource); } if (underlyingResource != null) { extendedResource = (IExtendedResourceProxy) createProxyListMethod.MakeGenericMethod(Info.ExtendedType, Info.ServerType).Invoke(null, new object[] { underlyingResource, Info }); } else { extendedResource = null; } cache[Property.Name] = extendedResource; return(extendedResource); }