private static object ConstructProxy(Type type, Assembly assembly, Incubator serviceProvider = null) { string proxyTypeName = "{0}Proxy"._Format(type.Name); Type proxyType = assembly.GetTypes().FirstOrDefault(t => t.Name.Equals(proxyTypeName)); if (proxyType == null) { Args.Throw <ArgumentException>("The proxy {0} for type {1} was not found in the specified assembly: {2}", proxyTypeName, type.Name, assembly.FullName); } object result = proxyType.Construct(type); if (serviceProvider != null) { serviceProvider.SetProperties(result); } return(result); }