public object Resolve(Type type) { lock (_registrations) { // 1. Find registration in the local dictionary ServiceRegistration registration; if (_registrations.TryGetValue(type, out registration)) { return(registration.Service); } // 2. Take service from the remote container object service = RemoteObject.Resolve(type); if (service == null) { return(null); } // 3. Get service registration by service interface type registration = ServiceRegistration.FromType(type, service); // 4. If registration was not found, then return null if (registration == null) { return(null); } // 5.Build proxy registration of the service registration = BuildRemoteServiceRegistration(registration); _registrations.Add(type, registration); return(registration.Service); } }