Beispiel #1
0
 protected void Application_Start(object sender, EventArgs e)
 {
     WindowsEventLog.AddEvent("WebDav Application_Start()", 9999);
     IoCSetup.ForceLoad(typeof(EC.Core.Common.ForceLoad));
     BootstrapContainer();
     SetupServices();
 }
Beispiel #2
0
        private static void RegisterTypes(IUnityContainer container)
        {
            var iocContainer = new IoCContainer(container);
            var iocSetup     = new IoCSetup();

            iocSetup.Setup(iocContainer);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            ////Initial
            //Console.WriteLine("I want to go home");
            //new Initial.CustomerBusinessLogic().GoHome();

            ////IoC
            //Console.WriteLine("I want to go home");
            //new IoC.CustomerBusinessLogic().GoHome();

            ////DIP
            //Console.WriteLine("I want to go home");
            //new DIP.CustomerBusinessLogic().GoHome();

            ////DependencyInjection
            //Console.WriteLine("I want to go home");
            //new DependencyInjection.CustomerBusinessLogic(new DependencyInjection.Bicycle()).GoHome();

            //AutoFac
            Console.WriteLine("I want to go home");
            var container = IoCSetup.Configure();
            var customerTransportation = container.Resolve <ICustomerTransportation>();

            customerTransportation.GoHome();
        }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(o => o.AddPolicy(_corsPolicy, builder =>
            {
                //TODO: for now this works....  Might want to restrict this or off-load the cors to NGINX or something...
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            if (_environmentName.ToLower() == "development")
            {
                // Register the Swagger generator, defining one or more Swagger documents
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new Info {
                        Title = "ACV Identity API", Version = "v1"
                    });
                });
            }

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            IoCSetup.CustomSetup(services, Configuration);
        }
        public GetWeatherFixture WireIoC()
        {
            FixtureElements = new GetWeatherFixtureElements();
            var builder   = IoCSetup.WireEverything();
            var container = builder.Build();

            FixtureElements.Container     = container;
            FixtureElements.LifetimeScope = container.BeginLifetimeScope();
            return(this);
        }
Beispiel #6
0
        protected void Application_Start()
        {
            var config = GlobalConfiguration.Configuration;

            config.Formatters.JsonFormatter.SerializerSettings.ContractResolver =
                new CamelCasePropertyNamesContractResolver();
            config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false;

            log4net.Config.XmlConfigurator.Configure();
            IoCSetup.WireEverything().ConnectToWebApiDependencyResovler();
            GlobalConfiguration.Configure(WebApiConfig.Register);
        }
Beispiel #7
0
        /// <summary>
        /// Initiates IOC
        /// </summary>
        /// <remarks>
        /// IoCSetupForceLoad() deals with the problem that the app is so loosely
        /// coupled that it won't bother loading some assemblies because it doesn't
        /// see direct references to this.
        /// </remarks>

        private void BootstrapContainer()
        {
            try
            {
                container = IoCSetup.Run("EC WebDav Application Starting", "EC-Web-Dav");
            }
            catch (Exception ex)
            {
                var msg = String.Format("EC WebDav Application Startup (BootstrapContainer) - Unexpected Exception [{0}]", ex.Message.ToString());
                WindowsEventLog.AddEvent(msg, WindowsEventLog.FatalError);
            }
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            //one argument must be passed in which is the environment to run as..
            Console.WriteLine("Running as environment: " + args[0].Trim());

            //set up configuration...
            IConfigurationRoot configuration = ConfigurationSetup.SetUpConfigs(args[0].Trim());

            //set up my IoC container....
            var provider = IoCSetup.CustomSetup(configuration);

            //resolve my dependencies
            var consumer                 = provider.GetService <IMessageConsumer>();
            var brokerSetings            = provider.GetService <IOptions <MessageBrokerConfigSingleton> >().Value;
            var userLoggedInEventHandler = provider.GetService <IHandleUserLoggedInEvent>();

            consumer.ListenAndConsumeMessage <UserLoggedInEvent>(brokerSetings.EventsTopicName, userLoggedInEventHandler.Handle);
        }
Beispiel #9
0
 public void InstallComponents(Castle.Windsor.IWindsorContainer w)
 {
     IoCSetup.RegisterAll(w, Assembly.GetExecutingAssembly());
 }