Winforms UI assembly has static FormManager.For mCreator method which creates
forms taking entity as parameter.
I need to pass this method to business objects in business assembly so that
business methods can also create
forms but does not have reference to UI assembly.
I tried code below but got compile errows shown in comments.
How to fix ?
Andrus.
////// This code is in Entry, Winforms UI assembly and has references to
business assembly
using System.Windows. Forms;
public delegate void ActivateEntityF orm<TEntity>();
class test
{
static void Main()
{
//Invalid expression term '>'
new
Customer().DoBu sinessLogicAndS howResultFormsU singFormManager (FormManager.Fo rmCreator<>);
}
}
public static class FormManager
{
public static void FormCreator<TEn tity>()
{
Form f = new Form();
f.Text = typeof(TEntity) .Name;
f.Show();
}
}
/// Code below resides in business assembly and should not have references
to assembly above
class Customer
{
public void
DoBusinessLogic AndShowResultFo rmsUsingFormMan ager<TChildEnti ty>(
ActivateEntityF orm<TChildEntit yformCreator)
{
//The variable 'x' cannot be used with type arguments
formCreator<Chi ldentity1>();
formCreator<Chi ldentity2>();
}
}
class Childentity1 { }
class Childentity2 { }