public object GetRequiredService(Type type) { IServiceCache service = null; if (!_cache.TryGetValue(type, out service)) { throw new Exception("获取参数对象没有注入"); } return(service.GetCache(_cache)); }
public T GetRequiredService <T>() { Type t = typeof(T); IServiceCache service = null; if (!_cache.TryGetValue(t, out service)) { throw new Exception("获取参数对象没有注入"); } return((T)service.GetCache(_cache)); }