OSCON 2015 - Introduction to .NET Core & ASP.NET Core
- Acquire & install (Windows, OS X, VS, VS Code, etc.)
- .NET Core SDK
- VS Code
- OmniSharp plug-in
- VS2015 Update 2
- VS2015 tools Preview 1
- Write our first app (Hello World of course!)
- mkdir -> dotnet new -> dotnet run
- dotnet ./output.dll
- demo use of dotnet build/run (e.g. change file, dotnet run, builds, etc.)
- Turn it into Hello World web app
- Add kestrel package
- Use WebHostBuilder to boot with inline middleware to reply
- Add console logging so we can see what we're doing set to debug level
- Serve static files by adding pre-built middleware
- Add static files package
- Create wwwroot/hello.html
- Add an API that returns an object
- Add MVC package
- Add MVC services
- Add MVC middleware
- Add Controllers/HelloController.cs
- Use POSTMAN to see it come back as JSON
- Let's build an Attendee List app
- Build our model: Models/Attendee.cs
- Add EF for persistance
- Add EF in-memory package
- Add EF services
- Add Data/WorkshopContext.cs
- Add Attendee DbSet property
- Add Controllers/AttendeesApiController.cs
- Add Get API
- Use POSTMAN to call it, no result yet
- Add Create API
- Use POSTMAN to call it, create record, then query it again
- Use POSTMAN to use the API, create and see attendees
- Let's add some UI to show and delete attendees
- Add a TypeScript file: wwwroot/app.ts
- Add a tsconfig.json to the root of the project
- Add a reference to the
- Change to SQL Lite
- Set up configuration to flow the connection string to SQL Lite
- Read from appsettings.json
- Read from environment variables
- Demonstrate overriding the configuration value in the file from the environment variables
- Add a required attribute to the model
- Attempt to POST an invalid attendee and see the 500 response
- Add Diagnostics page middleware to show in Development environment to aid in debugging via response
- Set the environment to Development:
ASPNETCORE_ENVIRONMENT=true
env var
- Attempt to POST invalid attendee again and this time see error page
- Add some code to turn validation errors into 400 responses:
BadRequest(ModelState)
- Preparing the app for deployment with
dotnet publish
- Modify the app to display details of the current OS on the home page (via an API & JS call)
- Publish the app to a USB key (from OS X)
- Run the app from the USB key on another machine (e.g. on Windows)
Extra topics if we have time
- Dependency Injection
- Server-side rendering with Razor
- Using
dotnet watch
via Microsoft.DotNet.Watcher.Tools
(currently broken)
- Deploy to azure