public object Bind(Type inputModelType, IBindingContext context) { //we determine the type by sniffing the ctor arg var entityType = inputModelType .GetConstructors() .Single(x => x.GetParameters().Count() == 1) .GetParameters() .Single() .ParameterType; var entity = tryFindExistingEntity(entityType, context) ?? createNewEntity(entityType, context); var model = (EditEntityModel)Activator.CreateInstance(inputModelType, entity); context.BindProperties(model); // Get the binding errors from conversion of the EditEntityModel context.Problems.Each(x => { model.Notification.RegisterMessage(x.Property, FastPackKeys.PARSE_VALUE); }); return(model); }
public object Bind(Type type, IBindingContext context) { object model = Activator.CreateInstance(type); context.BindProperties(model); return(model); }
public object Bind(Type inputModelType, IBindingContext context) { //we determine the type by sniffing the ctor arg var entityType = inputModelType .GetConstructors() .Single(x => x.GetParameters().Count() == 1) .GetParameters() .Single() .ParameterType; var entity = tryFindExistingEntity(entityType, context) ?? createNewEntity(entityType, context); var model = (EditEntityModel)Activator.CreateInstance(inputModelType, entity); context.BindProperties(model); // Get the binding errors from conversion of the EditEntityModel context.Problems.Each(x => { model.Notification.RegisterMessage(x.Property, FastPackKeys.PARSE_VALUE); }); return model; }
public object Bind(Type type, IBindingContext context) { var path = FindPath(context.Service<IRequestData>()); object instance = Activator.CreateInstance(type, path); // Setting additional properties // TODO -- have this delegate to a new method on BindingContext instead context.BindProperties(instance); return instance; }
public object Bind(Type type, IBindingContext context) { var path = FindPath(context.Service <IRequestData>()); var instance = Activator.CreateInstance(type, path); // Setting additional properties // TODO -- have this delegate to a new method on BindingContext instead context.BindProperties(instance); // START HERE AFTER BASEBALL return(instance); }
public object Bind(Type type, IBindingContext context) { var instance = Activator.CreateInstance(type); // let the default binders set all the route values and things context.BindProperties(instance); var data = context.Service<IStreamingData>().InputText(); var x = XDocument.Parse(data); // TODO - simple implementation. Would be susceptible to overwriting route values from query and url foreach (var element in x.Root.Elements()) { SetProperty(type, instance, element, element.Name.ToString()); } return instance; }
public object Bind(Type type, IBindingContext context) { object model = Activator.CreateInstance(type); context.BindProperties(model); return model; }