File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/Examples/CosmosDbExample Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 6
6
using Microsoft . AspNetCore . Authentication ;
7
7
using Microsoft . AspNetCore . Builder ;
8
8
using Microsoft . AspNetCore . Hosting ;
9
+ using Microsoft . Azure . Cosmos ;
9
10
using Microsoft . EntityFrameworkCore ;
10
11
using Microsoft . Extensions . Configuration ;
11
12
using Microsoft . Extensions . DependencyInjection ;
12
13
using Microsoft . Extensions . Logging ;
13
14
15
+ #pragma warning disable AV2310 // Code block should not contain inline comment
16
+
14
17
namespace CosmosDbExample
15
18
{
16
19
public sealed class Startup
@@ -35,7 +38,14 @@ public void ConfigureServices(IServiceCollection services)
35
38
36
39
services . AddDbContext < AppDbContext > ( options =>
37
40
{
38
- options . UseCosmos ( _connectionString , "TodoItemDB" ) ;
41
+ options . UseCosmos ( _connectionString , "TodoItemDB" , builder =>
42
+ {
43
+ builder . ConnectionMode ( ConnectionMode . Gateway ) ;
44
+ builder . LimitToEndpoint ( ) ;
45
+
46
+ // Fail fast!
47
+ builder . RequestTimeout ( TimeSpan . FromSeconds ( 10 ) ) ;
48
+ } ) ;
39
49
#if DEBUG
40
50
options . EnableSensitiveDataLogging ( ) ;
41
51
options . EnableDetailedErrors ( ) ;
You can’t perform that action at this time.
0 commit comments