コード例 #1
0
ファイル: Global.cs プロジェクト: deke/lokad-cqrs
        static Global()
        {
            CommitId = ConfigurationManager.AppSettings.Get("appharbor.commit_id");

            var settings = LoadSettings();

            var integrationPath = settings["DataPath"];
            var contracts       = Contracts.CreateStreamer();
            var strategy        = new DocumentStrategy();

            if (integrationPath.StartsWith("file:"))
            {
                var path   = integrationPath.Remove(0, 5);
                var config = FileStorage.CreateConfig(path);

                Docs   = config.CreateNuclear(strategy).Container;
                Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue));
            }
            else if (integrationPath.StartsWith("azure:"))
            {
                var path   = integrationPath.Remove(0, 6);
                var config = AzureStorage.CreateConfig(path);
                Docs   = config.CreateNuclear(strategy).Container;
                Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue));
            }
            else
            {
                throw new InvalidOperationException("Unsupported environment");
            }



            Forms = new FormsAuth(Docs.GetReader <UserId, LoginView>());
            Auth  = new WebAuth(Client);
        }
コード例 #2
0
ファイル: Global.cs プロジェクト: AGiorgetti/lokad-cqrs
        static Global()
        {
            CommitId = ConfigurationManager.AppSettings.Get("appharbor.commit_id");

            var settings = LoadSettings();

            var integrationPath = settings["DataPath"];
            var contracts = Contracts.CreateStreamer();
            var strategy = new DocumentStrategy();
            if (integrationPath.StartsWith("file:"))
            {
                var path = integrationPath.Remove(0, 5);
                var config = FileStorage.CreateConfig(path);

                Docs = config.CreateNuclear(strategy).Container;
                Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue));
            }
            else if (integrationPath.StartsWith("azure:"))
            {
                var path = integrationPath.Remove(0, 6);
                var config = AzureStorage.CreateConfig(path);
                Docs = config.CreateNuclear(strategy).Container;
                Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue));
            }
            else
            {
                throw new InvalidOperationException("Unsupperted environment");
            }

            Forms = new FormsAuth(Docs.GetReader<UserId, LoginView>());
            Auth = new WebAuth(Client);
        }