Exemplo n.º 1
0
        void Application_Start(object sender, EventArgs e)
        {
            if (documentStore == null)
            {
                if (ConfigurationManager.AppSettings["debuglocal"].ToString() == "true")
                {
                    documentStore = new DocumentStore() { Url = "http://localhost:8080" };
                    documentStore.Initialize();
                }
                else
                {
                    string connectionString = ConfigurationManager.AppSettings["RavenDBConnection"].ToString();
                    var connectionValues = connectionString.Split(';');
                    string url = connectionValues[0].Replace("Url=", string.Empty)
                                                        .Trim();
                    string apiKey = connectionValues[1].Replace("ApiKey=", string.Empty).Trim();

                    documentStore = new DocumentStore()
                    {
                        Url = url,
                        ApiKey = apiKey
                    };
                    documentStore.Initialize();
                }
            }

            Application["DocumentStore"] = documentStore;

            var repository = new RavenDBRepository(documentStore);
            var registry = new RavenFilterRegistry<Step>(repository);
            Application.Add("Registry", registry);
            Application.Add("Repository", repository);
        }
Exemplo n.º 2
0
        void Application_Start(object sender, EventArgs e)
        {
            if (documentStore == null)
            {
                if (ConfigurationManager.AppSettings["debuglocal"].ToString() == "true")
                {
                    documentStore = new DocumentStore()
                    {
                        Url = "http://localhost:8080"
                    };
                    documentStore.Initialize();
                }
                else
                {
                    string connectionString = ConfigurationManager.AppSettings["RavenDBConnection"].ToString();
                    var    connectionValues = connectionString.Split(';');
                    string url = connectionValues[0].Replace("Url=", string.Empty)
                                 .Trim();
                    string apiKey = connectionValues[1].Replace("ApiKey=", string.Empty).Trim();

                    documentStore = new DocumentStore()
                    {
                        Url    = url,
                        ApiKey = apiKey
                    };
                    documentStore.Initialize();
                }
            }

            Application["DocumentStore"] = documentStore;

            var repository = new RavenDBRepository(documentStore);
            var registry   = new RavenFilterRegistry <Step>(repository);

            Application.Add("Registry", registry);
            Application.Add("Repository", repository);
        }