public virtual T From <T>(ResolutionContext context)
            where T : YuzuMappingContext
        {
            var output = new YuzuMappingContext();

            AddDefaults(output, context);

            return(output as T);
        }
Пример #2
0
        public virtual T From <T>(IDictionary <string, object> items)
            where T : YuzuMappingContext
        {
            var output = new YuzuMappingContext();

            AddDefaults(output, items);

            return(output as T);
        }
        protected void AddDefaults(YuzuMappingContext output, ResolutionContext context)
        {
            output.Items       = context.Items;
            output.HttpContext = new HttpContextWrapper(HttpContext.Current);

            if (context.Items.ContainsKey("HtmlHelper"))
            {
                output.Html = context.Items["HtmlHelper"] as HtmlHelper;
            }
        }
Пример #4
0
        protected void AddDefaults(YuzuMappingContext output, IDictionary <string, object> items)
        {
            output.Items       = items;
            output.HttpContext = new HttpContextWrapper(HttpContext.Current);

            if (items.ContainsKey("HtmlHelper"))
            {
                output.Html = items["HtmlHelper"] as HtmlHelper;
            }
        }
Пример #5
0
        protected void AddDefaults(YuzuMappingContext output, IDictionary <string, object> items)
        {
            output.Items = items;

#if NETCOREAPP
            output.HttpContext = _httpContextAccessor.HttpContext;

            if (items.ContainsKey("HtmlHelper"))
            {
                output.Html = items["HtmlHelper"] as IHtmlHelper;
            }
#else
            output.HttpContext = new HttpContextWrapper(HttpContext.Current);

            if (items.ContainsKey("HtmlHelper"))
            {
                output.Html = items["HtmlHelper"] as HtmlHelper;
            }
#endif
        }