Skip to content

Instantly share code, notes, and snippets.

@Rookian
Created December 9, 2011 23:51
Show Gist options
  • Save Rookian/1453885 to your computer and use it in GitHub Desktop.
Save Rookian/1453885 to your computer and use it in GitHub Desktop.
StructureMap Factory
public class FormFactory : IFormFactory
{
private readonly Func<Type, object, Form> _createFormWithRuntimeParam;
public FormFactory(Func<Type, object, Form> createFormWithRuntimeParam)
{
_createFormWithRuntimeParam = createFormWithRuntimeParam;
}
public TForm CreateForm<TForm>() where TForm : Form
{
//return (TForm)_createFormWithRuntimeParam(typeof(TForm), null);
}
public TForm CreateForm<TForm>(object constructorParameter) where TForm : Form
{
return (TForm)_createFormWithRuntimeParam(typeof(TForm), constructorParameter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment