Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            DocumentDbService documentDbService = new DocumentDbService(Configuration.GetSection("CosmosDb"));
            // Store a test document for read load testing
            var     testDocumentService = new TestDocumentService();
            JObject toRead = (JObject)testDocumentService.GetDocument().DeepClone();

            toRead.Add("id", Constants.IdForReadTesting);
            documentDbService.UpsertItemAsync(toRead).Wait();
            services.AddSingleton <IDocumentDbService>(documentDbService);
            services.AddSingleton <ITestDocumentService>(testDocumentService);
            services.AddMvc();
        }