コード例 #1
0
 private static void Main()
 {
     FluentWindsor.NewContainer(typeof(Program).Assembly).WithArrayResolver().WithInstallers().Create();
     Console.WriteLine("Send signed request to requestbin...");
     Console.WriteLine("Request:");
     Console.WriteLine(SendSignedPostRequest().RequestMessage);
     Console.Read();
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: forki/fluentwindsor
        private static void Main(string[] args)
        {
            var container = FluentWindsor
                            .NewContainer(Assembly.GetExecutingAssembly())
                            .WithArrayResolver()
                            .WithInstallers()
                            .Create();

            var serviceC = container.Resolve <ServiceC>();

            serviceC.Execute();
        }
コード例 #3
0
        private static void Main(string[] args)
        {
            var container = FluentWindsor
                            .NewContainer(Assembly.GetExecutingAssembly())
                            .WithArrayResolver()
                            .WithInstallers()
                            .Create();

            var service = container.Resolve <ITestService>();

            service.DoSomething();

            Thread.Sleep(TimeSpan.FromSeconds(2));
        }
コード例 #4
0
ファイル: Global.asax.cs プロジェクト: forki/fluentwindsor
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            FluentWindsor
            .NewContainer(Assembly.GetExecutingAssembly())
            .WithArrayResolver()
            .WithInstallers()
            .RegisterApiControllers(GlobalConfiguration.Configuration)
            .RegisterMvcControllers(ControllerBuilder.Current, "Example.MVC.Controllers", "Another.Namespace.For.Controllers")
            .Create();
        }
コード例 #5
0
ファイル: Global.asax.cs プロジェクト: hamdiceylan/heimdall
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // See ./Providers to see how GetSecretFromUsername is installed
            FluentWindsor
            .NewContainer(Assembly.GetExecutingAssembly())
            .WithArrayResolver()
            .WithInstallers()
            .RegisterApiControllers(GlobalConfiguration.Configuration)
            .RegisterMvcControllers(ControllerBuilder.Current, "Example.IIS.Controllers")
            .Create();
        }
コード例 #6
0
        private static void Main(string[] args)
        {
            var container = FluentWindsor
                            .NewContainer(Assembly.GetExecutingAssembly())
                            .WithArrayResolver()
                            .WithInstallers()
                            .Create();

            var server = WebApp.Start <Startup>(BaseUri);

            var json = container.Resolve <ISyncJsonService>();

            var result = json.Get <IEnumerable <Person> >(FormatUri("api/persons"));

            foreach (var item in result)
            {
                System.Console.WriteLine($"Found person! -> {item}");
            }

            System.Console.ReadLine();

            server.Dispose();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: forki/fluentwindsor
        private static void Main(string[] args)
        {
            var TimeoutInMilliseconds = 5000;

            ManualResetEvent wait = new ManualResetEvent(false);

            var container = FluentWindsor
                            .NewContainer(Assembly.GetExecutingAssembly())
                            .WithArrayResolver()
                            .WithInstallers()
                            .Create();


            long isComplete = 0;

            var readCounter   = 0;
            var createCounter = 0;
            var deleteCounter = 0;

            var cache = container.Resolve <ICache <Guid> >();

            // Reader
            var reader = Task.Factory.StartNew(() =>
            {
                while (Interlocked.Read(ref isComplete) == 0)
                {
                    readCounter++;
                    foreach (var p in cache)
                    {
                        System.Console.Write(".");
                    }
                    Thread.Sleep(1);
                }
            });

            // Creator
            var creator = Task.Factory.StartNew(() =>
            {
                while (Interlocked.Read(ref isComplete) == 0)
                {
                    createCounter++;
                    var newGuid = Guid.NewGuid();
                    cache.SetItem(newGuid.ToString("N"), newGuid);
                    System.Console.Write("+");
                    Thread.Sleep(1);
                }
            });

            // Deleter
            var deleter = Task.Factory.StartNew(() =>
            {
                while (Interlocked.Read(ref isComplete) == 0)
                {
                    if (cache.Count > 0)
                    {
                        deleteCounter++;
                        var key = cache.AllKeys.First();
                        cache.ExpireItem(key);
                        System.Console.Write("-");
                    }
                    Thread.Sleep(1);
                }
            });

            // Monitor
            Task.Factory.StartNew(() =>
            {
                Thread.Sleep(TimeoutInMilliseconds);
                Interlocked.Exchange(ref isComplete, 1);
                wait.Set();
            });

            wait.WaitOne();

            System.Console.WriteLine("Reads: {0}, Creates: {1}, Deletes: {2} in {3} second(s).".FormatWith(readCounter, createCounter, deleteCounter, TimeoutInMilliseconds / 1000));

            System.Console.ReadLine();
        }