Пример #1
0
        static void Main()
        {
            // Kick off the IoC container.
            // Initialize the service locator (InstanceFactory)
            InitializeNinject.StartUp();

            // Use this instead because of (bad design) the need to tell ninject
            // which constructor to use for IoC/DI. Found at:
            // http://stackoverflow.com/questions/8777475/whats-the-difference-between-toconstructor-and-tomethod-in-ninject-3
            // The following example was pulled from the DapperPlayground project.
            // It worked as needed until a much-needed refactoring took place which
            // removed the necessity for the following code:
            //IKernel vKernel = InitializeNinject.StartupAndReturnKernel();
            //vKernel
            //	.Rebind<ISqlServerConnectionFactory>()
            //	.ToConstructor<SqlServerConnectionFactory>
            //	(
            //		ctorArg =>
            //			new SqlServerConnectionFactoryNamedConnection(ctorArg.Inject<IAWESettings>())
            //	);

            // Instantiate the instance
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            mfIoCWinForm vForm = InstanceFactory.GetInstance <mfIoCWinForm>();

            Application.Run(vForm);
        }
Пример #2
0
        public static int Main(string[] args)
        {
            // Kick off the IoC container.
            // Initialize the service locator (InstanceFactory)
            InitializeNinject.StartUp();

            // Instantiate the instance
            ProgramIoCConsole vProgram = InstanceFactory.GetInstance <ProgramIoCConsole>();
            int vResult = vProgram.DoTheProgram(args);

            return(vResult);
        }
Пример #3
0
        //--------------------------------------------------------------------------
        // Begin IoC methodology
        //--------------------------------------------------------------------------

        private static void StartUpIoC()
        {
            // Use this instead because of (bad design) the need to tell ninject
            // which constructor to use for IoC/DI. Found at:
            // http://stackoverflow.com/questions/8777475/whats-the-difference-between-toconstructor-and-tomethod-in-ninject-3

            // Kick off the IoC container.
            // Initialize the service locator (InstanceFactory)
            InitializeNinject.StartUp();

            // Instantiate the instance
            // Once again, we are forced to use a Bad Design (the "Service Locator"
            // pattern, but, also again, there is no other way to invoke IoC.
            _MainForm = InstanceFactory.GetInstance <mfIoCWinForm>();
        }
Пример #4
0
        private static int DoItTheIoCWay(string[] args)
        {
            // Kick off the IoC container.
            // Initialize the service locator (InstanceFactory)
            InitializeNinject.StartUp();

            // Instantiate the instance
            // Normally, this is a Bad Practice. However, since there isn't an easier
            // way to jump start the IoC, the program needs to go get the initial
            // instance.
            ProgramIoCConsole vProgram =
                InstanceFactory.GetInstance <ProgramIoCConsole>();
            int vResult = vProgram.DoTheProgram(args);

            return(vResult);
        }
Пример #5
0
        static void Main(string[] args)
        {
            // Kick off the IoC container.
            // Initialize the service locator (InstanceFactory)
            InitializeNinject.StartUp();

            // Instantiate the instance
            // ServiceBase[] ServicesToRun;
            // ServicesToRun = new ServiceBase[] { new IoCService() };
            IoCService vService = InstanceFactory.GetInstance <IoCService>();

#if DEBUG
            if (Debugger.IsAttached && (args != null) && (args.Length > 0) && (args[0] == "-Console"))
            {
                vService.Timer_Elapsed(vService, null);
                return;
            }
#endif
            ServiceBase.Run(vService);
        }
Пример #6
0
 // Must convert this from [TestFixtureSetUp] to constructor because if we
 // are using [TestCaseSource] (which fires BEFORE [TestFixtureSetUp])
 // this won't get executed in time.
 protected BASE_IntegrationTest()
 {
     InitializeNinject.StartUp();
     _TransactionScope = new TransactionScope();
     TablesToReseed    = new List <string>();
 }