public static WindsorContainer ConfigureWindsor(IConfiguration Configuration) { var container = new WindsorContainer(); container.Register(Component.For <ISessionSource>().ImplementedBy <AspNetCoreNHibernateSessionSource>().LifeStyle.Scoped()); WindsorIoC.Initialize(container); container.RegisterComponents(); var configurationSection = Configuration.GetSection("AppSettings"); var collection = new NameValueCollection(); foreach (var appSetting in configurationSection.GetChildren()) { collection.Add(appSetting.Key, appSetting.Value); } container.Register(Component.For <ApplicationSettingsProvider>().ImplementedBy <ApplicationSettingsProvider>() .DynamicParameters((k, d) => d.Add("collection", collection)) .LifeStyle.Singleton); container.Install(new LoggerWindsorInstaller()); container.Install(new EdugameCloud.Core.Logging.LoggerWindsorInstaller()); RegisterLtiComponents(container); return(container); }
/// <summary> /// The application_ start. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Application_Start(object sender, EventArgs e) { var container = new WindsorContainer(); WindsorIoC.Initialize(container); DIConfig.RegisterComponents(container); // TRICK: remove all files on start CachePolicies.InvalidateCache(); }
protected void Application_Start(object sender, EventArgs e) { var container = new WindsorContainer(); WindsorIoC.Initialize(container); DIConfig.RegisterComponents(container); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); //RouteConfig.RegisterRoutes(RouteTable.Routes); //BundleConfig.RegisterBundles(BundleTable.Bundles); MvcHandler.DisableMvcResponseHeader = true; }
public void WillGetMp4Value() { var container = new WindsorContainer(); WindsorIoC.Initialize(container); DIConfig.RegisterComponents(container); XmlConfigurator.Configure(); var logger = IoC.Resolve <ILogger>(); var serviceUrl = new Uri("http://connectdev.esynctraining.com"); var proxy = new AdobeConnectProxy(new AdobeConnectProvider(new ConnectionDetails(serviceUrl)), logger, serviceUrl, string.Empty); var loginResult = proxy.Login(new UserCredentials("*****@*****.**", "NEp2NV44Sj")); var getFieldValue = proxy.GetAclField("44636", "x-385564"); var mp4 = JsonConvert.DeserializeObject <Mp4Dto>(getFieldValue); }
protected void Application_Start() { var container = new WindsorContainer(); WindsorIoC.Initialize(container); container.RegisterComponents(); RegisterComponentsWeb(container); container.Install(new Esynctraining.CastleLog4Net.LoggerWindsorInstaller()); container.Install(new EdugameCloud.Core.Logging.LoggerWindsorInstaller()); RegisterLtiComponents(container); RegisterLocalComponents(container); GlobalConfiguration.Configure(WebApiConfig.Register); GlobalConfiguration.Configuration.Services.Replace( typeof(IHttpControllerActivator), new ServiceLocatorControllerActivator(new WindsorServiceLocator(container))); }
protected void Application_Start() { var webformVE = ViewEngines.Engines.OfType <WebFormViewEngine>().FirstOrDefault(); ViewEngines.Engines.Remove(webformVE); var container = new WindsorContainer(); WindsorIoC.Initialize(container); container.RegisterComponents(); RegisterLtiComponents(container); RegisterComponentsWeb(container); container.Install(new LoggerWindsorInstaller()); container.Install(new EdugameCloud.Core.Logging.LoggerWindsorInstaller()); RegisterLocalComponents(container); RegisterHttpClient(container); SetControllerFactory(container); AreaRegistration.RegisterAllAreas(); var modelBinders = container.ResolveAll(typeof(BaseModelBinder)); foreach (var binder in modelBinders) { var modelBinder = (BaseModelBinder)binder; if (modelBinder.BinderTypes != null) { foreach (var binderType in modelBinder.BinderTypes) { ModelBinders.Binders.Add(binderType, modelBinder); } } } DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new WindsorValidatorFactory(new WindsorServiceLocator(container), IoC.Resolve <ILogger>()))); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); DefaultModelBinder.ResourceClassKey = "Errors"; MvcHandler.DisableMvcResponseHeader = true; string pathPropertiesPath = this.GetPathPropertiesPath(); container.Register(Component.For <FlexSettingsProvider>().ImplementedBy <FlexSettingsProvider>().DynamicParameters((k, d) => d.Add("collection", FlexSettingsProvider.ReadSettings(pathPropertiesPath))).LifeStyle.Singleton); }
/// <summary> /// The application_ start. /// </summary> protected void Application_Start() { var webformVE = ViewEngines.Engines.OfType <WebFormViewEngine>().FirstOrDefault(); ViewEngines.Engines.Remove(webformVE); var container = new WindsorContainer(); WindsorIoC.Initialize(container); container.RegisterComponents(); RegisterComponentsWeb(container); container.Install(new LoggerWindsorInstaller()); container.Install(new Esynctraining.Core.Logging.CastleLogger.LoggerWindsorInstaller()); RegisterLocalComponents(container); SetControllerFactory(container); AreaRegistration.RegisterAllAreas(); //var modelBinders = container.ResolveAll(typeof(BaseModelBinder)); //foreach (var binder in modelBinders) //{ // var modelBinder = (BaseModelBinder)binder; // if (modelBinder.BinderTypes != null) // { // foreach (var binderType in modelBinder.BinderTypes) // { // ModelBinders.Binders.Add(binderType, modelBinder); // } // } //} DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new WindsorValidatorFactory(new WindsorServiceLocator(container), IoC.Resolve <ILogger>()))); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); DefaultModelBinder.ResourceClassKey = "Errors"; MvcHandler.DisableMvcResponseHeader = true; AuthConfig.RegisterAuth(container.Resolve <ApplicationSettingsProvider>()); }
public static void Main() { try { log4net.Config.XmlConfigurator.Configure(); // Logger initialized later with LoggingFacility var container = new WindsorContainer(); container.Register(Component.For <IInstance>().ImplementedBy <DummyOne>()); container.Register(Component.For <IInstance>().ImplementedBy <DummyTwo>()); container.Register(Component.For <ILogger>().ImplementedBy <Log4NetLogger>()); var ioc = new WindsorIoC(container); var host = new Host(ioc); host.Start(); } catch (Exception e) { Console.WriteLine(e); throw; } Console.ReadLine(); }
void RunUmdRecordingsReport() { var container = new WindsorContainer(); WindsorIoC.Initialize(container); DIConfig.RegisterComponents(container); var logger = IoC.Resolve <ILogger>(); var accountService = new AdobeConnectAccountService(logger); // IAdobeConnectProxy ac = accountService.GetProvider(new AdobeConnectAccess("https://webmeeting.umd.edu/", "*****@*****.**", "e$ync123UMD"), true); var apiUrl = new Uri("https://webmeeting.umd.edu"); var connectionDetails = new ConnectionDetails(apiUrl); var provider = new AdobeConnectProvider(connectionDetails); LoginResult loginResult = provider.Login(new UserCredentials("*****@*****.**", "e$ync123UMD")); var recordings = provider.GetRecordingsList(null); //some id here // var recordingsWithoutCreate = recordings.Values.Where(x => x.DateCreated == default(DateTime)).ToList(); // var recordingsWithoutCreateWithEnd = recordingsWithoutCreate.Where(x => x.EndDate != default(DateTime)).ToList(); var recordingsWithoutEnd = recordings.Values.Where(x => x.EndDate == default(DateTime)).Select(x => x.ScoId); var result = recordings.Values.Where(x => recordingsWithoutEnd.All(r => r != x.ScoId) && x.ScoId != "2434849").ToList(); //2434849 - rec without start date, can't calculate duration double duration = 0; double biggestDuration = 0; string biggestRecSco = null; var recsAfter_20150601 = result.Where(x => x.DateCreated >= new DateTime(2015, 06, 01)); foreach (var rec in recsAfter_20150601) { var scoInfo = provider.GetScoInfo(rec.ScoId); var rec1 = provider.GetRecordingsList(scoInfo.ScoInfo.FolderId, rec.ScoId); TimeSpan ts; if (TimeSpan.TryParse(rec1.Values.First().Duration, out ts)) { duration += ts.TotalMinutes; if (ts.TotalMinutes > biggestDuration) { biggestDuration = ts.TotalMinutes; biggestRecSco = rec.ScoId; } } else { Console.WriteLine($"There was a problem with scoId={rec.ScoId} . Could not parse Duration={rec1.Values.First().Duration}"); } } Console.WriteLine($"Total recordings count after 2015/05/31 :{recsAfter_20150601.Count()}"); Console.WriteLine($"Total recordings duration(in minutes) after 2015/05/31 :{duration}"); Console.WriteLine($"The longest meeting duration(in minutes) after 2015/05/31 :{biggestDuration}, scoId={biggestRecSco}"); var recsBefore20150601 = result.Where(x => x.DateCreated < new DateTime(2015, 06, 01)); duration = 0; biggestDuration = 0; foreach (var rec in recsBefore20150601) { var scoInfo = provider.GetScoInfo(rec.ScoId); var rec1 = provider.GetRecordingsList(scoInfo.ScoInfo.FolderId, rec.ScoId); TimeSpan ts; if (TimeSpan.TryParse(rec1.Values.First().Duration, out ts)) { duration += ts.TotalMinutes; if (ts.TotalMinutes > biggestDuration) { biggestDuration = ts.TotalMinutes; biggestRecSco = rec.ScoId; } } else { Console.WriteLine($"There was a problem with scoId={rec.ScoId} . Could not parse Duration={rec1.Values.First().Duration}"); } } Console.WriteLine($"Total recordings count before 2015/05/31 :{recsBefore20150601.Count()}"); Console.WriteLine($"Total recordings duration(in minutes) before 2015/05/31 :{duration}"); Console.WriteLine($"The longest meeting duration(in minutes) before 2015/05/31 :{biggestDuration}, scoId={biggestRecSco}"); Console.ReadLine(); }
protected void Application_Start() { var webformVE = ViewEngines.Engines.OfType <WebFormViewEngine>().FirstOrDefault(); ViewEngines.Engines.Remove(webformVE); var container = new WindsorContainer(); WindsorIoC.Initialize(container); container.RegisterComponents(); RegisterComponentsWeb(container); container.Install(new LoggerWindsorInstaller()); container.Install(new EdugameCloud.Core.Logging.LoggerWindsorInstaller()); RegisterLtiComponents(container); //RegisterLocalComponents(container); SetControllerFactory(container); AreaRegistration.RegisterAllAreas(); //var modelBinders = container.ResolveAll(typeof(BaseModelBinder)); //foreach (var binder in modelBinders) //{ // var modelBinder = (BaseModelBinder)binder; // if (modelBinder.BinderTypes != null) // { // foreach (var binderType in modelBinder.BinderTypes) // { // ModelBinders.Binders.Add(binderType, modelBinder); // } // } //} DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; //ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(new WindsorValidatorFactory(new WindsorServiceLocator(container), IoC.Resolve<ILogger>()))); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); DefaultModelBinder.ResourceClassKey = "Errors"; MvcHandler.DisableMvcResponseHeader = true; AuthConfig.RegisterAuth(container.Resolve <ApplicationSettingsProvider>(), container.Resolve <IHttpClientFactory>()); GlobalConfiguration.Configure(WebApiConfig.Register); GlobalConfiguration.Configuration.Services.Replace( typeof(IHttpControllerActivator), new ServiceLocatorControllerActivator(new WindsorServiceLocator(container))); // TRICK: remove all files on start CachePolicies.InvalidateCache(); ServicePointManager.DefaultConnectionLimit = int.Parse(ConfigurationManager.AppSettings["DefaultConnectionLimit"]); ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; //hack - to use parameterized Resolve in LmsFactory. Must be removed when corresponding methods are added to IoC and IServiceLocator if (!container.Kernel.HasComponent(typeof(IWindsorContainer))) { container.Register((IRegistration)Component.For <IWindsorContainer>().Instance(container).LifestyleSingleton()); } }