예제 #1
0
        private static IContainer CompositionRoot(ApplicationOptions options)
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <PlayerStatisticStorage>().AsImplementedInterfaces().SingleInstance();
            builder.RegisterType <ServerStatisticStorage>().AsImplementedInterfaces().SingleInstance();
            builder.RegisterType <ReportStorage>().AsImplementedInterfaces().SingleInstance();
            builder.RegisterType <GlobalServerStatisticStorage>().AsImplementedInterfaces().SingleInstance();

            builder.RegisterInstance(new RavenDbStorage(RavenDbStore.GetStore(options)))
            .As <IDataRepository>()
            .SingleInstance();

            builder.RegisterType <DataStatisticStorage>().As <IDataStatisticStorage>().SingleInstance();

            builder.RegisterAssemblyTypes(Assembly.GetAssembly(typeof(BaseModule)))
            .Where(t => t.IsAssignableTo <IServerModule>())
            .AsImplementedInterfaces();
            builder.RegisterType <HttpServer>().AsImplementedInterfaces();
            builder.RegisterInstance(new HttpServerOptions {
                Prefix = options.Prefix
            }).AsSelf();

            return(builder.Build());
        }
예제 #2
0
        private IContainer ConfigureContainer()
        {
            var builder = new ContainerBuilder();

            RegisterMediatorPipeline(builder);

            builder.RegisterModule <SantaAutofacModule>();

            // Logging
            //builder.RegisterModule<NLogModule>();
            builder
            .RegisterType <ConsoleLogger>()
            .As <IConsoleLogger>();

            // RavenDB
            builder
            .RegisterInstance(RavenDbStore.Initialize())
            .As <IDocumentStore>()
            .SingleInstance();

            var container = builder.Build();

            // The below returns:
            //  - RequestPreProcessorBehavior
            //  - RequestPostProcessorBehavior
            //  - GenericPipelineBehavior

            //var behaviors = container
            //    .Resolve<IEnumerable<IPipelineBehavior<Ping, Pong>>>()
            //    .ToList();
            return(container);
        }
예제 #3
0
 public virtual void Setup()
 {
     GlobalStatisticStorage = new GlobalServerStatisticStorage();
     ServerStatisticStorage = new ServerStatisticStorage(GlobalStatisticStorage);
     PlayerStatisticStorage = new PlayerStatisticStorage();
     ReportStorage          = new ReportStorage(ServerStatisticStorage, PlayerStatisticStorage);
     DocumentStore          = RavenDbStore.GetStore(new ApplicationOptions
     {
         InMemory    = true,
         UnitTesting = true
     });
     DataRepository   = new RavenDbStorage(DocumentStore);
     StatisticStorage = new DataStatisticStorage(
         DataRepository,
         GlobalStatisticStorage,
         ServerStatisticStorage,
         PlayerStatisticStorage,
         ReportStorage);
 }
예제 #4
0
        public void Can_Insert_Into_RavenDb()
        {
            var            fixture       = new Fixture();
            var            title         = fixture.Create <string>();
            IDocumentStore documentStore = new RavenDbStore().Instance;
            string         id            = fixture.Create <string>();

            using (var session = documentStore.OpenSession())
            {
                string projectId      = fixture.Create <string>();
                var    taskInGridView = new TaskInGridView(id, projectId, title,
                                                           fixture.Create <DateTime>().ToShortDateString(), ProjectPriority.Low.DisplayName, true);
                session.Store(taskInGridView);
                session.SaveChanges();
            }

            using (var session = documentStore.OpenSession())
            {
                var taskInGridView = session.Load <TaskInGridView>(id);
                // WaitForUserToContinueTheTest(documentStore, true, 8079);
                Assert.That(taskInGridView, Is.Not.Null);
            }
            documentStore.Dispose();
        }
예제 #5
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     RavenDbStore.CleanUp();
 }
예제 #6
0
        public static void Start()
        {
            RavenDbStore.Initialize();

            RavenProfiler.InitializeFor(RavenDbStore.DocumentStore, "HashedPassword", "PasswordSalt");
        }