@@ -12,8 +12,7 @@ type Parent =
1212 FirstName: string }
1313
1414[<CLIMutable>]
15- type Pet =
16- { GivenName: string }
15+ type Pet = { GivenName: string }
1716
1817[<CLIMutable>]
1918type Child =
@@ -61,21 +60,22 @@ let insertFamilies<'T> conn (families: 'T list) =
6160// this is to test a broken query in the analyzer
6261let getFamiliesBroken conn =
6362 conn
64- |> Cosmos.query< Family> " SELECT * FROM f WHERE f.Name = @name AND f.Age = @AGE"
65- |> Cosmos.parameters
66- [ " age" , box 35
67- " lastName" , box " Powell" ]
68- |> Cosmos.execAsync
63+ |> Cosmos.query " SELECT * FROM f WHERE f.Name = @name AND f.Age = @AGE"
64+ |> Cosmos.parameters [ " age" , box 35
65+ " lastName" , box " Powell" ]
66+ |> Cosmos.execAsync< Family>
6967
7068let getFamilies conn =
7169 conn
72- |> Cosmos.query< Family > " SELECT * FROM f WHERE f.LastName = @lastName"
70+ |> Cosmos.query " SELECT * FROM f WHERE f.LastName = @lastName"
7371 |> Cosmos.parameters [ " @lastName" , box " Powell" ]
74- |> Cosmos.execAsync
72+ |> Cosmos.execAsync< Family >
7573
7674let updateFamily conn id pk =
7775 conn
78- |> Cosmos.update< Family> id pk ( fun family -> { family with IsRegistered = not family.IsRegistered })
76+ |> Cosmos.update< Family> id pk ( fun family ->
77+ { family with
78+ IsRegistered = not family.IsRegistered })
7979 |> Cosmos.execAsync
8080
8181let deleteFamily conn id pk =
@@ -85,12 +85,19 @@ let deleteFamily conn id pk =
8585
8686[<EntryPoint>]
8787let main argv =
88- let environmentName = System.Environment.GetEnvironmentVariable( " ASPNETCORE_ENVIRONMENT" )
88+ let environmentName =
89+ System.Environment.GetEnvironmentVariable( " ASPNETCORE_ENVIRONMENT" )
90+
8991 let builder =
9092 JsonConfigurationExtensions.AddJsonFile
9193 ( JsonConfigurationExtensions.AddJsonFile
9294 ( FileConfigurationExtensions.SetBasePath( ConfigurationBuilder(), Directory.GetCurrentDirectory()),
93- " appsettings.json" , true , true ), sprintf " appsettings.%s .json" environmentName, true , true )
95+ " appsettings.json" ,
96+ true ,
97+ true ),
98+ sprintf " appsettings.%s .json" environmentName,
99+ true ,
100+ true )
94101
95102 let config = builder.Build()
96103
@@ -99,9 +106,11 @@ let main argv =
99106 // let key = config.["CosmosConnection:Key"]
100107 // let conn = getFamiliesConnection host key
101108
102- let connectionString = config.[ " CosmosConnection:ConnectionString" ]
109+ let connectionString =
110+ config.[ " CosmosConnection:ConnectionString" ]
103111
104- let conn = getFamiliesConnectionFromConnString connectionString
112+ let conn =
113+ getFamiliesConnectionFromConnString connectionString
105114
106115 let families =
107116 [| { Id = " Powell.1"
@@ -118,16 +127,20 @@ let main argv =
118127 |> Array.toList
119128
120129 let insert = insertFamilies conn families
121- do ! insert |> AsyncSeq.iter ( fun f -> printfn " Inserted: %A " f)
130+ do ! insert
131+ |> AsyncSeq.iter ( fun f -> printfn " Inserted: %A " f)
122132
123133 let families = getFamilies conn
124- do ! families |> AsyncSeq.iter ( fun f -> printfn " Got: %A " f)
134+ do ! families
135+ |> AsyncSeq.iter ( fun f -> printfn " Got: %A " f)
125136
126137 let updatePowell = updateFamily conn " Powell.1" " Powell"
127- do ! updatePowell |> AsyncSeq.iter ( fun f -> printfn " Updated: %A " f)
138+ do ! updatePowell
139+ |> AsyncSeq.iter ( fun f -> printfn " Updated: %A " f)
128140
129141 let deletePowell = deleteFamily conn " Powell.1" " Powell"
130- do ! deletePowell |> AsyncSeq.iter ( fun f -> printfn " Deleted: %A " f)
142+ do ! deletePowell
143+ |> AsyncSeq.iter ( fun f -> printfn " Deleted: %A " f)
131144
132145 return 0 // return an integer exit code
133146 }
0 commit comments