Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil Hartley 10 posts 31 karma points
    Mar 11, 2015 @ 20:50
    Neil Hartley
    0

    Ninject DI and Code First

    Hi guys,

    Im using contour for a project and have developed a code first form which inherits from FormBase. Everything works perfectly find until I try to inject a dependent service into the constructor.

    Im using ninject as my Ioc container and am simply trying to pass in my unit of work

    public class ContactForm : FormBase

     

     

     

    {

     

     

     

    ..........

    "public ContactForm(IUnitOfWork unitOfWork)"

    however the default constructor from FormBase does not accept any parameters.

    If you might be able to point me in the right direction in terms of using a constructor parameter it would be greatly appreciated.

    Kind Regards,

    Neil

  • Yakov Lebski 591 posts 2346 karma points
    Mar 11, 2015 @ 22:15
    Yakov Lebski
    0

    I think that it's will not work, because Forms not use Factory to create forms.

    you use anti pattern for it DependencyResolver.Current.GetService

Please Sign in or register to post replies

Write your reply to:

Draft