Created
December 9, 2011 23:51
-
-
Save Rookian/1453885 to your computer and use it in GitHub Desktop.
StructureMap Factory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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