Ejemplo n.º 1
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var store = controllerContext.BinderStore();
            var currentProp = store.CurrentProperty;

            if (!currentProp.Name.Equals(bindingContext.ModelName))
            {
                store.MemberOf = "";
                store.CurrentProperty = currentProp = new GlimpseModelBoundProperties { Name = bindingContext.ModelName, Type = bindingContext.ModelType };
            }
            currentProp.ModelBinderType = this.GetType().BaseType;

            //Trace.Write(string.Format("BINDMODEL ModelName:{0}, ModelType:{1}", bindingContext.ModelName, bindingContext.ModelType), "Selected");
            var result = ModelBinder.BindModel(controllerContext, bindingContext);

            currentProp.RawValue = result;

            return result;
        }
Ejemplo n.º 2
0
        public void Intercept(IInvocation invocation)
        {
            //public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)

            var controllerContext = (ControllerContext) invocation.Arguments[0];
            var bindingContext = (ModelBindingContext) invocation.Arguments[1];

            var store = controllerContext.BinderStore();
            var currentProp = store.CurrentProperty;

            if (!currentProp.Name.Equals(bindingContext.ModelName))
            {
                store.MemberOf = "";
                store.CurrentProperty = currentProp = new GlimpseModelBoundProperties { Name = bindingContext.ModelName, Type = bindingContext.ModelType };
            }
            currentProp.ModelBinderType = invocation.TargetType;

            //Trace.Write(string.Format("BINDMODEL ModelName:{0}, ModelType:{1}", bindingContext.ModelName, bindingContext.ModelType), "Selected");
            invocation.Proceed();

            currentProp.RawValue = invocation.ReturnValue;
        }
Ejemplo n.º 3
0
        public void Intercept(IInvocation invocation)
        {
            //public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)

            var controllerContext = (ControllerContext)invocation.Arguments[0];
            var bindingContext    = (ModelBindingContext)invocation.Arguments[1];

            var store       = controllerContext.BinderStore();
            var currentProp = store.CurrentProperty;

            if (!currentProp.Name.Equals(bindingContext.ModelName))
            {
                store.MemberOf        = "";
                store.CurrentProperty = currentProp = new GlimpseModelBoundProperties {
                    Name = bindingContext.ModelName, Type = bindingContext.ModelType
                };
            }
            currentProp.ModelBinderType = invocation.TargetType;

            //Trace.Write(string.Format("BINDMODEL ModelName:{0}, ModelType:{1}", bindingContext.ModelName, bindingContext.ModelType), "Selected");
            invocation.Proceed();

            currentProp.RawValue = invocation.ReturnValue;
        }