Exemplo n.º 1
0
        public Task Run(SimpleIoc ioc)
        {
            var path  = ioc.Resolve <IOwinContext>().Request.Path;
            var route = _routes.SingleOrDefault(r => path.StartsWithSegments(new PathString(r.Prefix)));

            route = route ?? _notFound;

            return(route.Handler(ioc));
        }
Exemplo n.º 2
0
        public TTypeToResolve Resolve <TTypeToResolve>(SimpleIoc child = null)
            where TTypeToResolve : class
        {
            Func <SimpleIoc, object> resolveFunc;

            if (_typeResolvers.TryGetValue(typeof(TTypeToResolve), out resolveFunc))
            {
                return((TTypeToResolve)resolveFunc(child ?? this));
            }
            else
            {
                return(_parent != null?
                       _parent.Resolve <TTypeToResolve>(this) :
                           (TTypeToResolve)null);
            }
        }
Exemplo n.º 3
0
 public SimpleIoc(SimpleIoc parent = null)
 {
     _parent = parent;
 }