File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -6,28 +6,31 @@ open RepoDb
66open RepoDb.Extensions
77open FSharpRepoDB.Types
88
9- let url ( argv : string array ) =
9+ let getUrl ( argv : string array ) =
1010 let getFromEnv =
1111 System.Environment.GetEnvironmentVariable( " MSSQL_DB_URL" )
1212 |> Option.ofObj
1313
1414 let fromArgsOrEnv =
1515 argv
16- |> Array.tryFind( fun arg -> arg.Contains " --dburl= " )
17- |> Option.map ( fun f -> f.Split( '= ' ) |> Seq.tryLast)
16+ |> Array.tryFind( fun arg -> arg.Contains " --dburl~ " )
17+ |> Option.map ( fun f -> f.Split( '~ ' ) |> Seq.tryLast)
1818 |> Option.flatten
1919 |> Option.orElse getFromEnv
2020
21- fromArgsOrEnv |> Option.defaultValue " Server=127.0.0.1 ;Database=TestDB;User Id=sa;Password=Password1! ;"
21+ fromArgsOrEnv |> Option.defaultValue " Server=. ;Database=TestDB;Integrated Security=SSPI ;"
2222
2323[<EntryPoint>]
2424let main argv =
25+ // you can set "MSSQL_DB_URL" env variable or run the following command to use a Custom URL for testing purposes
26+ /// dotnet run -p FSharpRepoDB -- "--dburl~Server=127.0.0.1;Database=TestDB;User Id=sa;Password=Password1!;"
2527
2628 // Initialize the SQL Server
2729 SqlServerBootstrap.Initialize()
2830
2931 // Open the connection
30- let connection = ( new SqlConnection( url argv)) .EnsureOpen()
32+ let url = getUrl argv
33+ let connection = ( new SqlConnection( url)) .EnsureOpen()
3134
3235 // Get the fields
3336 let personType = typedefof< Person>
You can’t perform that action at this time.
0 commit comments