예제 #1
0
        internal static RuntimeContainerWrapper GetIocContainerWrapper(this NancyContext context)
        {
            object childContainer;
            var    childContainerSuffix = "BootstrapperChildContainer";

            if (cachedIocContainerKey == null || !context.Items.TryGetValue(cachedIocContainerKey, out childContainer))
            {
                var item =
                    context.Items.Where(x => x.Key.EndsWith(childContainerSuffix)).OrderByDescending(
                        x =>
                        RuntimeContainerWrapper.PreferredContainersTypes.Contains(
                            x.Key.Substring(x.Key.Length - childContainerSuffix.Length))).First();
                cachedIocContainerKey = item.Key;
                childContainer        = item.Value;
            }
            return(RuntimeContainerWrapper.Create(childContainer));
        }
예제 #2
0
 protected RuntimeContainerWrapper CreateWrapper()
 {
     return(RuntimeContainerWrapper.Create(Container));
 }