Skip to content

mhinze/unbound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

/* I've traditionally used an extension method like this.  blah.ToHttpDictionary()
 * Pretty useful sometimes. 
 * If you need a custom unbinder, implement ISpecificValueUnbinder and plug it in to the CustomUnbinders.
 * A custom unbinder would take a specific value from an object - one that your model binding
 * infrastructure would use to recreate your object.  This is used in our system for entities and 
 * enumeration classes.
 */

public static class UnboundExtension
{
	static UnboundExtension()
	{
		SpecificValueUnbinderFactory.CustomBinders
			= () => new ISpecificValueUnbinder[]
			        	{
			        		new FooUnbinder(),
			        	};
	}

	public static IDictionary<string, string> ToHttpDictionary(this object request, string prefix)
	{
		return new Unbinder().Unbind(request, prefix);
	}
}

About

Serialize objects to model bindable dictionary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages