-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
40 lines (35 loc) · 1.34 KB
/
Program.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Learn more about F# at http://fsharp.org
open System
open Microsoft.AspNetCore.Hosting
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Http
open Microsoft.AspNetCore.Routing
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection
open Microsoft.EntityFrameworkCore
open DotnetTest.DatabaseContext
type Startup() =
member this.Configure(app:IApplicationBuilder) =
let setStandardRoute (routes:IRouteBuilder) =
routes.MapRoute(
name = "default",
template = "{controller}/{action}/{id?}"
) |> ignore
let app = app.UseMvc(fun r -> setStandardRoute r)
()
member this.ConfigureServices(services:IServiceCollection) =
services.AddMvc() |> ignore
let connectionString = "Server=(localdb)\\mssqllocaldb;Database=fsharptest;Trusted_Connection=True;MultipleActiveResultSets=true"
services.AddDbContext<DatabaseContext>(fun options -> options.UseSqlServer(connectionString)|> ignore) |> ignore
()
[<EntryPoint>]
let main argv =
let host =
WebHostBuilder()
.UseKestrel()
.UseUrls("http://localhost:5000")
.UseIISIntegration()
.UseStartup<Startup>()
.Build()
host.Run()
0 // return an integer exit code