public KnockoutWithContext <TItem> With <TItem>(Expression <Func <TModel, TItem> > binding) { var expression = KnockoutExpressionConverter.Convert(binding, CreateData()); var regionContext = new KnockoutWithContext <TItem>(viewContext, expression); regionContext.WriteStart(viewContext.Writer); regionContext.ContextStack = ContextStack; ContextStack.Add(regionContext); return(regionContext); }
public KnockoutWithContext <TItem> With <TItem>(Expression <Func <TModel, TItem> > binding) { Func <TModel, TItem> func = binding.Compile(); var model = (TItem)func((TModel)ViewContext.ViewData.Model); var expression = KnockoutExpressionConverter.Convert(binding, CreateData()); var regionContext = new KnockoutWithContext <TItem>(ViewContext, expression, model); regionContext.WriteStart(ViewContext.Writer); regionContext.ContextStack = ContextStack; ContextStack.Add(regionContext); return(regionContext); }