コード例 #1
0
ファイル: Form1.cs プロジェクト: rollemira/Architecture-Azure
        private void searchRead_Click(object sender, EventArgs e)
        {
            int loop = Int32.Parse(txtLoop.Text);

            Interface.Repository.IIndexerRepository azureSearch = DI.Container.Resolve <Interface.Repository.IIndexerRepository>();

            Model.Search.SearchLargeObjectModel searchLargeObjectModel = new Model.Search.SearchLargeObjectModel();
            searchLargeObjectModel.LargeObjectId = largeObjectModel.LargeObjectId.ToString();
            searchLargeObjectModel.Payload       = largeObjectModel.Payload;

            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
            for (int i = 1; i <= loop; i++)
            {
                azureSearch.LargeObjectSearch(Interface.GlobalEnum.IndexerIndexName.LargeObject, i.ToString());
            }
            stopwatch.Stop();

            txtResult.Text  = string.Empty;
            txtResult.Text += "Read Write (" + loop.ToString() + ") took: " + stopwatch.ElapsedMilliseconds.ToString() + " milliseconds." + Environment.NewLine;
            txtResult.Text += "Read Write (" + loop.ToString() + ") took: " + (stopwatch.ElapsedMilliseconds / 1000).ToString() + " seconds." + Environment.NewLine;
        }
コード例 #2
0
        public void LargeObjectAzureSearch()
        {
            Model.LargeObject.LargeObjectModel largeObjectModel = this.CreateLargeObjectModel();
            largeObjectModel.LargeObjectId = 1;

            // This would save to blob or somewhere
            //Interface.Service.ILargeObjectService largeObjectService = DI.Container.Resolve<Interface.Service.ILargeObjectService>();
            //largeObjectService.Save(largeObjectModel);

            Model.Search.SearchLargeObjectModel searchLargeObjectModel = new Model.Search.SearchLargeObjectModel();
            searchLargeObjectModel.LargeObjectId = largeObjectModel.LargeObjectId.ToString();
            searchLargeObjectModel.Payload       = largeObjectModel.Payload;

            Interface.Repository.IIndexerRepository azureSearch = DI.Container.Resolve <Interface.Repository.IIndexerRepository>();

            azureSearch.UpsertLargeObject(Interface.GlobalEnum.IndexerIndexName.LargeObject, searchLargeObjectModel);

            List <Model.Search.SearchLargeObjectModel> list = azureSearch.LargeObjectSearch(
                Interface.GlobalEnum.IndexerIndexName.LargeObject, largeObjectModel.LargeObjectId.ToString());

            Assert.AreEqual(list[0].LargeObjectId, largeObjectModel.LargeObjectId.ToString());
        } // LargeObjectAzureSearch