コード例 #1
0
ファイル: Domain.cs プロジェクト: mikeball/MBACNationals
        public static void RebuildReadModel(string readmodel)
        {
            GoOffline();

            var untypedModel = typeof(Domain).GetField(readmodel).GetValue(null);

            if (untypedModel is IReadModel)
            {
                var instance = ((IReadModel)untypedModel);

                instance.Reset();
                Dispatcher.RegenerateReadModel(readmodel);
                instance.Save();
            }
            else
            {
                var tableStorageConn = ConfigurationManager.ConnectionStrings["AzureTableStorage"].ConnectionString;
                var storageAccount   = CloudStorageAccount.Parse(tableStorageConn);
                var tableClient      = storageAccount.CreateCloudTableClient();

                var azureTableHelper  = new AzureTableHelper.AzureTableHelper(tableClient);
                var originalTableName = azureTableHelper.GetTableNameFor(readmodel.ToLower());
                azureTableHelper.IterateTableNameFor(readmodel.ToLower());

                Dispatcher.RegenerateReadModel(readmodel);

                azureTableHelper.DeleteTable(originalTableName);
            }

            GoOnline();
        }
コード例 #2
0
        public AzureReadModel(string modelName)
        {
            ModelName = modelName;

            var tableStorageConn = ConfigurationManager.ConnectionStrings["AzureTableStorage"].ConnectionString;
            var storageAccount   = CloudStorageAccount.Parse(tableStorageConn);

            var servicePoint = ServicePointManager.FindServicePoint(storageAccount.TableEndpoint);

            servicePoint.UseNagleAlgorithm = false;
            servicePoint.Expect100Continue = false;
            servicePoint.ConnectionLimit   = 100;

            var tableClient = storageAccount.CreateCloudTableClient();

            AzureTableHelper = new AzureTableHelper.AzureTableHelper(tableClient);

            var blobClient = storageAccount.CreateCloudBlobClient();

            AzureBlobHelper = new AzureTableHelper.AzureBlobHelper(blobClient);
        }