예제 #1
0
 public CampaignController(DocumentStoreHolder holder, IEnumerable <ICharacterSheet> characterSheetTypes)
 {
     MongoDb             = holder.GetDefaultDatabase();
     CampaignCollection  = MongoDb.GetCollection <Campaign>("CampaignCollection");
     CharacterCollection = MongoDb.GetCollection <dynamic>("RpgCharModels");
     CharacterSheetTypes = characterSheetTypes;
 }
예제 #2
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     DocumentStoreHolder.Initailize();
     RegisterGlobalFilters(GlobalFilters.Filters);
     RegisterRoutes(RouteTable.Routes);
 }
예제 #3
0
 public OrderController(
     ILogger <OrderController> logger,
     DocumentStoreHolder documentStoreHolder,
     IEventBus eventBus)
 {
     _logger = logger;
     _documentStoreHolder = documentStoreHolder;
     _eventBus            = eventBus;
 }
 public override void OnActionExecuting(HttpActionContext filterContext)
 {
     DocumentStoreHolder.Url = _uri ?? null;
     DocumentStoreHolder.ConnectionStringName = !string.IsNullOrEmpty(_connectionStringName)
                                                                                                         ? _connectionStringName
                                                                                                         : null;
     filterContext.Request.Properties["RavenDocumentStore"] =
         DocumentStoreHolder.TryAddSession(filterContext.ControllerContext.Controller);
 }
예제 #5
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     DocumentStoreHolder.Initailize();
     TryCreatingIndexesOrRedirectToErrorPage();
     RegisterGlobalFilters(GlobalFilters.Filters);
     RegisterRoutes(RouteTable.Routes);
     this.InitApp(LifestyleType.PerWebRequest);
 }
예제 #6
0
        public IDocumentStore GetDocumentStore()
        {
            if (_inMemory)
            {
                return(DocumentStoreHolder.GetInMemoryStore());
            }

            return(DocumentStoreHolder.GetStore());
        }
예제 #7
0
        public DeleteUnusedDatabasesTask(DocumentStoreHolder documentStoreHolder, Settings settings, ILogger <DeleteUnusedDatabasesTask> logger)
        {
            _documentStoreHolder = documentStoreHolder;
            _logger = logger;

            var expirationSettings = settings.DeleteUnusedDatabases.ExpirationSpan;

            _expirationSpan = expirationSettings.ToTimeSpan();
        }
예제 #8
0
 public NewOrderCreatedIntegrationEventHandler(
     ILogger <NewOrderCreatedIntegrationEventHandler> logger,
     IEggService eggService,
     DocumentStoreHolder documentStoreHolder)
 {
     _logger              = logger;
     _eggService          = eggService;
     _documentStoreHolder = documentStoreHolder;
 }
예제 #9
0
        public void Configuration(IAppBuilder app)
        {
            DocumentStoreHolder.SetDbInfo("DemoServer", "Northwind", "Media");

            var configuration = new HttpConfiguration();

            DemoServer.Configure(configuration);

            app.UseWebApi(configuration);
        }
예제 #10
0
        protected void Application_Start()
        {
            DocumentStoreHolder.Initialize();
            ImportData.Import(DocumentStoreHolder.Store);

            WebApiSetup.Setup(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalConfiguration.Configuration.Filters);
            RouteConfig.RegisterRoutes(GlobalConfiguration.Configuration.Routes);
            CommonSetup.Setup();
        }
예제 #11
0
        protected IDocumentStore NewDocumentStore()
        {
            var store = new EmbeddableDocumentStore {
                RunInMemory = true
            };

            DocumentStoreHolder.SetupConventions(store.Conventions);
            store.Initialize();
            documentStores.Add(store);
            return(store);
        }
예제 #12
0
        private static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.UTF8;
            Console.OutputEncoding = Encoding.UTF8;

            DocumentStoreHolder.Initialize();

            new OpenSiddurOpenDocumentImporter().Import();
            //new CommandsRunner().LookForCommands();

            DocumentStoreHolder.Shutdown();
        }
예제 #13
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

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

            JsonMediaTypeFormatter jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;

            // jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            jsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter());
            DocumentStoreHolder.Initialize();
        }
예제 #14
0
        public static void Initialize()
        {
            foreach (var configurationItem in Configuration.Init())
            {
                DocumentStoreHolder.Init(configurationItem.Endpoint);

                foreach (var destination in configurationItem.ToPopulate)
                {
                    options = new SessionOptions {
                        Database = destination.Database
                    };
                    SeedEverything();
                }
            }
        }
예제 #15
0
        private void AddItemsToDatabase(List <SiddurSnippet> snippets)
        {
            using (var session = DocumentStoreHolder.OpenSession())
            {
                foreach (var siddurSnippet in snippets)
                {
                    if (siddurSnippet.Slug == null)
                    {
                        siddurSnippet.Id = "rawImport/SiddurSnippet/" + siddurSnippet.Id;
                    }
                    else
                    {
                        siddurSnippet.Id = null;
                    }

                    session.Store(siddurSnippet);
                }
                session.SaveChanges();
            }
        }
예제 #16
0
 public static void ExcuteLater(ICommand command)
 {
     Task.Factory.StartNew(() =>
     {
         var succcessfully = false;
         try
         {
             DocumentStoreHolder.TryAddSession(command);
             command.Execute();
             succcessfully = true;
         }
         finally
         {
             DocumentStoreHolder.TryComplete(command, succcessfully);
         }
     }, TaskCreationOptions.LongRunning)
     .ContinueWith(task =>
     {
         ErrorLog.GetDefault(null).Log(new Error(task.Exception));
     }, TaskContinuationOptions.OnlyOnFaulted);
 }
        public static void Cleanup()
        {
            foreach (var configurationItem in Configuration.Init())
            {
                DocumentStoreHolder.Init(configurationItem.Endpoint);

                foreach (var itemToDelete in configurationItem.ToDelete)
                {
                    var options = new SessionOptions {
                        Database = itemToDelete.Database
                    };

                    if (itemToDelete.Collection.Equals("ALL"))
                    {
                        ClearDatabase(options);
                        continue;
                    }

                    DeleteItemsFromCollection(options, itemToDelete.Collection);
                }
            }
        }
예제 #18
0
        static void Main(string[] args)
        {
            string demoServerUrl = "localhost:9090";
            string databaseName  = "Demo";

            if (args.Length > 0)
            {
                if (args[0] != null)
                {
                    switch (args[0])
                    {
                    case "-h":
                    case "-help":
                    case "--help":
                    case "/h":
                    case "/?":
                    {
                        Console.WriteLine(@"");
                        Console.WriteLine(@"DemoServer Usage : demoserver [-h] [-ds address] [-dn databaseName]");
                        Console.WriteLine(@"");
                        Console.WriteLine(@"    -ds address : Demo Server's address.");
                        Console.WriteLine(@"                  Default : 'localhost:9090'");
                        Console.WriteLine(@"");
                        Console.WriteLine(@"    -dn address : Database Name");
                        Console.WriteLine(@"                  Default : 'Demo'");
                        Console.WriteLine(@"");
                        Console.WriteLine(@"Note : Do not add 'http://' prefix to addresses.");
                        Console.WriteLine(@"");
                    }
                        return;

                    default:
                    {
                        bool readDs = false;
                        bool readDn = false;
                        for (int i = 0; i < args.Length; i++)
                        {
                            if (args[i] != null)
                            {
                                if (readDs == true)
                                {
                                    demoServerUrl = args[i];
                                    readDs        = false;
                                    continue;
                                }
                                if (readDn == true)
                                {
                                    databaseName = args[i];
                                    readDn       = false;
                                    continue;
                                }

                                if (args[i].Equals("-ds"))
                                {
                                    readDs = true;
                                }
                                else if (args[i].Equals("-dn"))
                                {
                                    readDn = true;
                                }
                                else
                                {
                                    Console.WriteLine("");
                                    Console.WriteLine("Error : Bad usage parameters. Use -h for help.");
                                    Console.WriteLine("");
                                    return;
                                }
                            }
                        }
                    }
                    break;
                    }
                }
            }
            demoServerUrl = string.Format("Http://{0}", demoServerUrl);
            var dsUri = new Uri(demoServerUrl);

            DocumentStoreHolder.SetDbInfo("DemoServer", databaseName, "Media");
            var server = new DemoServer();

            server.Start(dsUri.Host, dsUri.Port);
        }
 public ApiController(DocumentStoreHolder holder, IOptions <MongoConfig> options)
 {
     MongoDb     = holder.Store.GetDatabase("RpgCharModelDb");
     MongoConfig = options.Value;
 }
예제 #20
0
 public FiveECharController(DocumentStoreHolder holder)
 {
     MongoDb = holder.GetDefaultDatabase();
 }
예제 #21
0
 public EggService(ILogger <EggService> _logger, DocumentStoreHolder documentStoreHolder)
 {
     this._logger         = _logger;
     _documentStoreHolder = documentStoreHolder;
 }
예제 #22
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     DocumentStoreHolder.TryAddSession(filterContext.Controller);
 }
예제 #23
0
파일: List.cs 프로젝트: aspdev/reactivities
 public Handler(DocumentStoreHolder storeHolder)
 {
     _store = storeHolder.Store;
 }
예제 #24
0
 public MediaStoreCache(IMemoryCache memoryCache, DocumentStoreHolder documentStoreHolder, DatabaseName databaseName)
     : base(memoryCache, documentStoreHolder)
 {
     _databaseName = databaseName;
 }
예제 #25
0
 public GenericCharacterController(DocumentStoreHolder holder, IEnumerable <ICharacterSheet> characterSheetTypes)
 {
     MongoDb = holder.GetDefaultDatabase();
     this.characterSheetTypes = characterSheetTypes;
 }
예제 #26
0
 public override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     DocumentStoreHolder.TryComplete(filterContext.Controller, filterContext.Exception == null);
 }
예제 #27
0
 public Handler(DocumentStoreHolder documentStore)
 {
     _store = documentStore.Store;
 }
예제 #28
0
 public EggPlantController(ILogger <EggPlantController> logger, DocumentStoreHolder documentStoreHolder)
 {
     _logger = logger;
     _documentStoreHolder = documentStoreHolder;
 }
예제 #29
0
 protected DocumentStoreCache(IMemoryCache memoryCache, DocumentStoreHolder documentStoreHolder)
 {
     _memoryCache         = memoryCache;
     _documentStoreHolder = documentStoreHolder;
 }