Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to .NET Core

1,348 views

Published on

There has been a lot of talk around the new upcoming version of ASP.NET 5, or is it ASP.NET Core 1.0? Also a new version of .NET and a new version of Entity Framework was in development for some time. Since June we can now start using these technologies since they have reached their first official stable version: .NET Core 1.0, ASP.NET Core 1.0 and Entity Framework Core 1.0.

In this talk we will discuss the need for .NET Core, ASP.NET Core and Entity Framework Core and its new features using a shitload of samples.

Published in: Technology
  • Be the first to comment

Introduction to .NET Core

  1. 1. .NET Core Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  2. 2. I work for Involved A group of passionate software engineers who design, build and deliver software using .NET and the best bits of the Web “ ”
  3. 3. Agenda • Overview • .NET Core • samples • ASP.NET Core • samples • Entity Framework Core • samples
  4. 4. Welcome to .NET! You can build any kind of application you want with .NET, from cloud to IoT to games. You can start building your next application today, for Windows, Linux, Android, macOS, and iOS. There are millions of developers that use .NET to power mission critical applications, personal apps and immersive games.
  5. 5. Overview • The .NET Family .NET .NET Core Xamarin .NET Native Mono Unity
  6. 6. .NET Core • Build apps • Devices, Web, Cloud, IoT/Embedded • OpenSource • Cross-platform • Windows • MacOS • Linux • x86, x64, ARM*
  7. 7. .NET Core is a general purpose development platform maintained by Microsoft and the .NET community on GitHub. It is cross-platform, supporting Windows, macOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.
  8. 8. .NET Core • .NET Runtime (CoreCLR) • Framework libraries (Core Library) • Tools and language compilers (Core SDK) • The ‘dotnet” app host (dotnet) C# VB F#
  9. 9. .NET Core • Single application model • Console apps • Additional application models on top • ASP.NET Core • UWP
  10. 10. .NET Core .NET FRAMEWORK .NET CORE XAMARIN Base Class Library Core Library Mono Class Library WPF Windows Forms ASP.NET UWP ASP.NET Core iOS Android OS X
  11. 11. .NET Core .NET FRAMEWORK .NET CORE XAMARIN Base Class Library Core Library Mono Class Library .NET STANDARD FRAMEWORK COMMON INFRASTRUCTURE Compilers Languages Runtime components
  12. 12. .NET Core PLATFORM ALIAS .NET Standard netstandard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 .NET Core netcoreapp 1.0 .NET Framework net 4.5 4.5.1 4.6 4.6.1 4.6.2 * Xamarin * UWP uap 10.0 Windows win 8.0 8.1 Windows Phone wpa 8.1 Windows Phone Silverlight wp 8.0
  13. 13. Samples Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  14. 14. Docker • Docker for Windows • Show local docker images • Show running containers • Login to Docker Hub https://docs.docker.com/docker-for-windows/ PS> docker images PS> docker ps PS> docker login
  15. 15. Docker • Create image based on a dockerfile • Run a docker image • Remove a docker image • Publish a docker image on Docker Hub PS> docker build -t yourname/imagename . PS> docker run -it yourname/imagename PS> docker rmi yourname/imagename -f PS> docker push yourname/imagename
  16. 16. ASP.NET Core • Redesign of ASP.NET from scratch • Used for building cloud based internet connected applications • Based on granular NuGet packages • Start from nothing • Add only what you need! • Console Application creating a web server
  17. 17. ASP.NET Core ASP.NET 4.6 ASP.NET Core 1.0 .NET Framework 4.6 .NET Core 1.0 CLR en BCL CoreCLR en CL
  18. 18. ASP.NET Core • Helios WebServer (in-process in IIS, deprecated) • Relied on System.Web (full CLR) • Kestrel (libuv-based, cross-platform) • Production HTTP(S) server for ASP.NET Core • Not fully-featured • Run it behind a more fully-featured web server (NGNIX, IIS) • Libuv (used by NodeJS, very efficient) • IIS -> HttpPlatformHandler IIS Module -> Kestrel
  19. 19. ASP.NET Core ASP.NET Core Application Kestrel Request Response
  20. 20. Samples Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  21. 21. ASP.NET Core Middleware Middleware Middleware Kestrel Request Response
  22. 22. ASP.NET Core MIDDLEWARE 1 MIDDLEWARE 2 MIDDLEWARE 3 Request Response // logic(); next(); // logic(); next(); // logic(); // more logic(); // more logic(); // more logic();
  23. 23. Samples Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  24. 24. ASP.NET Core • MVC is back! • Middleware (UseMvc) • NuGet Package • WebAPI is back! • Middleware (UseMvc) • NuGet Package • ASP.NET MVC == ASP.NET WebAPI • No more ApiController
  25. 25. Samples Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  26. 26. ASP.NET Core • Built in support for Dependency injection • Constructor injection • Action Injection with [FromServices] • Transient • Transient lifetime services are created each time they are requested • Scoped • Scoped lifetime services are created once per request • Singleton • Singleton lifetime services are created the first time they are requested and then every subsequent request will use the same instance
  27. 27. Samples Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  28. 28. Entity Framework Core • EF4 • Available in .NET Framework, Tooling in VS • EF5 • Runtime on NuGet, Core runtime in .NET, Tooling in VS • EF 6 • Runtime on NuGet, Tooling OpenSource on CodePlex • EF Core 1.0 • Runtime and Tooling on NuGet, OpenSource on GitHub
  29. 29. Entity Framework Core • Designed from scratch • Providers for both relational and non relational storage • Better performance • OpenSource on GitHub • Relational (columns table) • SQL Server, SQLLite, Postgres, … • Non Relational Data Stores • Azure Table Storage, Redis, …
  30. 30. Entity Framework Core • Supported providers • Microsoft SQL Server • SQLLite • PostgreSQL • Microsoft SQL Server Compact Edition • IBM Data Servers • InMemory (for testing) • Devart (MySQL, Oracle, PostgreSQL, SQLLite, DB2, SQL Server) • MySQL* • Oracle*
  31. 31. Entity Framework Core • Not implemented in 1.0.0 • Lazy loading • Stored procedure mapping • Limited LINQ translator • Automatic many-to-many mapping • DataBase First • Will Scaffold C# objects from an existing database • Code First • Will use migrations to create or update a database • Model first is no longer supported!
  32. 32. Samples Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke
  33. 33. EF Tools • Check if EF Tools are installed • Add migration (Code-First) • Update database (Code-First) • Scaffold model from database (Database-First) PS> dotnet ef --help PS> dotnet ef migrations add MigrationName PS> dotnet ef database update PS> Scaffold-DbContext "connectionstring" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
  34. 34. references • https://www.microsoft.com/net/ • http://www.asp.net/core • https://docs.efproject.net/en/latest/ • https://docs.microsoft.com/en-us/dotnet/ • https://docs.microsoft.com/en-us/dotnet/articles/welcome • https://docs.asp.net/en/latest/
  35. 35. and we’re done Johnny Hooyberghs johnny.hooyberghs@involved-it.be @djohnnieke

×