public T CreateProxy <T>(ulong objectId) where T : class { lock (_syncRoot) { if (Log.IsDebugEnabled) { Log.DebugFormat("{0}: Adding proxy '#{1}' of type '{2}'", _remotingEndPoint.Name, objectId, typeof(T).FullName); } var proxy = _codeGenerator.CreateProxy <T>(_remotingEndPoint, _endPointChannel, objectId); var grain = new WeakReference <IProxy>((IProxy)proxy); _proxiesById.Add(objectId, grain); return(proxy); } }