NancyModule ad with generics

Is it possible to create a nancy module like this:

public class TypeParamModule<Type1, Type2, Type3> : NancyModule
{
    public TypeParamModule()
    {
        Get["/"] = parameters =>
        {
            //action here
        }
    }
}

      

If possible, where to set the type parameters. Can I "hard" register the module somewhere in the bootloader?

Thank!

+3


source to share


1 answer


First of all, you must declare TypeParamModule

how abstract

to avoid Nancy trying to create an instance of create for it
Then you can create any specified module like this:PersonModule: TypeParamModule<Person, City, Nation>



0


source







All Articles