Working with SQL Server using .NET Standard 2.0

Slides:



Advertisements
Similar presentations
Cloud Computing Cosa, come e perché? Giancarlo Lelli Microsoft MVP – Avanade
Advertisements

What is it all about? .NET MeetUp in Prague, CZ (2017/7/19)
Three Runtimes, one standard… .NET Standard: All in Visual Studio 2017
12/29/2017 2:33 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Modernizing your. NET applications with. NET Standard,
IT Operations Management
The Xamarin Promise - Realized
Unleash .NET 2015 in your apps
Introduction to ASP.NET Core
Accelerate your DevOps with OpenShift by Red Hat
5/15/2018 5:43 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
DotnetConf 9/10/2018 7:49 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE.
Introduction to ASP.NET 2.0
ASP.NET Core: Web apps, cloud apps, and containers
6/2/2018 4:08 AM BRK3327 Ten things you didn't know about building .NET UWP apps in Visual Studio 2017 Daniel Jacobson Program Manager – Visual Studio.
6/8/ :30 AM BRK3304 Modern .NET: Cloud, Containers, Microservices and Mobile all in Visual Studio 2017 Scott Hunter, Director PM Kasey.
Easily manage SQL everywhere from anywhere with SQL tools
The Future of C# The Future of C# and VB 2-577
UI Test Automation with Appium
Building a Continuous Delivery Pipeline for ASP.NET Core Apps
IT Operations Management
SQL Server + PHP: What’s New
Did your feature got in, out or planned?
Building Innovative Apps using the Microsoft Developer Platform
Designing Cross Platform Applications on .NET Core
Modern Web Development
SQL Server 2017 Deep Dive Tobias Ternstrom, Travis Wright
DNN Connect 2017 Microsoft Keynote
Introducing ASP.NET Core 2.0
Microsoft Virtual Academy
1.1. .NET architectural components and .NET Core
Learn. Imagine. Build. .NET Conf
.NET Standard Jon Galloway | Executive Director, .NET |
Course Introduction Haiming Chen Department of Computer Science
What is it all about? .NET MeetUp in Amsterdam, NL (2017/7/11)
Microsoft Ignite NZ October 2016 SKYCITY, Auckland
Building Modern Web Apps with ASP.NET MVC 6
Sviluppo mobile con Visual Studio OnLine
Slides and images stolen from “real” .NET Conf. presenters
DotnetConf 11/14/2018 3:27 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE.
Overview of the .NET Platform
Microsoft Ignite /14/ :21 AM BRK2101
11/14/ :24 AM BRK2069 Build powerful new applications for the enterprise on Windows 10 with the Universal Windows Platform Ginny Caughey President.
Microsoft Build /14/ :29 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
11/14/ :30 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Microsoft Build /15/2018 6:28 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
.NET and .NET Core Foot View of .NET Pan Wuming 2017.
Learn. Imagine. Build. .NET Conf
Entity Framework Core.
ASP.NET 5 on .NET Core Damian Edwards Principal Program Manager.
Microsoft Connect /1/2018 2:36 AM
12/3/2018 7:56 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Microsoft Virtual Academy
12/9/2018 Desktop Virtualization Corey Hynes Kyle Rosenthal President Technical Lead HynesITe Inc Spider Consulting @windowspcguy.
1/2/2019 9:19 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS.
Angular in the .NET World
Microsoft Connect /22/2019 9:54 PM
Microsoft Connect /24/ :10 PM
SharePoint Development
4/11/2019 6:29 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Learning with Xamarin Workbooks
Windows Server 2016 Guest Offering September 19, 2016
5/6/2019 7:40 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS.
Data Access in .NET Core 3.0 Applications
Microsoft Virtual Academy
Microsoft Virtual Academy
The Future is Now with ASP.NET Core 3.0
Blazor A new framework for browser-based .NET apps Ryan Nowak
11/11/2019 1:15 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
What’s ASP.NET 5 and Why? Scott Hunter | Director of Program Management Scott Hanselman | Principal Program Manager.
Presentation transcript:

Working with SQL Server using .NET Standard 2.0 Marco Minerva @marcominerva Working with SQL Server using .NET Standard 2.0

Sponsor

.NET Standard 2.0

.NET today – reusing code .NET FRAMEWORK .NET Framework BCL ASP.NET Windows Forms WPF .NET CORE .NET Core BCL UWP ASP.NET Core XAMARIN Mono BCL iOS Android OS X MODELS APP Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different. LIBRARIES BASE

.NET today – reusing code .NET FRAMEWORK .NET CORE XAMARIN CHALLENGES Difficult to reuse skills Need to master 3+1 base class libraries Difficult to reuse code Need to target a fairly small common denominator Difficult to innovate Need implementations on each platform MODELS APP ASP.NET Windows Forms WPF UWP ASP.NET Core iOS Android OS X Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different. LIBRARIES BASE .NET Framework BCL .NET Core BCL Mono BCL

.NET tomorrow .NET Standard .NET FRAMEWORK .NET CORE XAMARIN MODELS APP ASP.NET Windows Forms WPF UWP ASP.NET Core iOS Android OS X Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different. LIBRARIES BASE .NET Standard

.NET tomorrow .NET Standard Reuse skills .NET FRAMEWORK .NET CORE XAMARIN BENEFITS Reuse skills Master one BCL, not a Venn diagram Reuse code Common denominator is much bigger Faster innovation Target .NET Standard & run anywhere MODELS APP ASP.NET Windows Forms WPF UWP ASP.NET Core iOS Android OS X Notes: Even if we are reusing a lot across components (especially with the open sourcing last year), the reality is that each platform has its own implementation of the base libraries. Note: .NET Framework BCL and Mono BCL are the same APIs, different implementation. .NET Core “Core Library” is a similar set of APIs, but different. LIBRARIES BASE .NET Standard

11/12/2018 9:56 PM What is .NET Standard? .NET Standard is a specification A set of APIs that all .NET platforms have to implement .NET Standard .NET Framework .NET Core Xamarin ~ HTML specification Browsers © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

.NET Standard versions 11/12/2018 9:56 PM Che cosa significa compatibile? Significa ad esempio che in un’applicazone .NET Framework 4.6.1 possiamo utilizzare tutte le API definite nella versione 2.0 di .NET Stadard. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Versioning in .NET Standard 11/12/2018 9:56 PM Versioning in .NET Standard Higher versions incorporate all APIs from previous versions. Projects targeting version X.Y can reference libraries & projects targeting any version between 1.0 and X.Y Concrete .NET platforms implement a specific version of .NET Standard From that platform you can reference libraries up to that version 2.0 1.6 1.3 1.0 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

11/12/2018 9:56 PM .NET Standard 2.0 Has much bigger API surface Extended to cover intersection between .NET Framework and Xamarin Makes .NET Core 2.0 bigger as it implements .NET Standard 2.0 +20K More APIs than .NET Standard 1.x Can reference .NET Framework libraries Compat shim allows referencing existing .NET Framework code – without recompilation Limited to libs that use APIs that are available for .NET Standard ~70% of NuGet packages are API compatible Compat shim: l’adozione di .NET Standard ha un potenziale problema, che sicuramente alcuni di voi avranno già notato. Cosa succede se io decido di aggiornare una mia libreria, ma essa dipende ad esempio da un pacchetto NuGet esterno che non è ancora stato aggiornato a .NET Standard? Devo aspettare che tutte le librerie che uso vengano aggiornate, prima di poter lavorare sul mio codice? Questo in effetti rappresenterebbe un grosso problema all’adozione di .NET Standard. Uso il condizionale perché per fortuna non è così, o quantomeno non lo è del tutto. Qui si inserisce il Compat shim: è possibile da .NET Standard referenziare librerie .NET Framework esistenti senza ricompilazione. In pratica è una modalità “proviamo e vediamo se funziona”. Cerchiamo di capire meglio, perché detta così non sembra una cosa molto convincente. Quello che si è notato è che circa il 70% dei pacchetti NuGet esistenti sono già compatibili con .NET Standard dal punto di vista delle API utilizzate. Questa è una sorta di “best effort”. Ovviamente è necessario verificare il proprio codice per assicurarsi che tutto funzioni davvero sulle varie piattaforme, ma grazie a questo support possiamo aggiornare (o quantomeno provare ad aggiornare) le nostre librerie a .NET Standard e usare comunque pacchetti NuGet esistenti senza dover aspettare che anche questi ultimi vengano a loro volta portati su .NET Standard. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

.NET Standard and SQL Server

The road so far (before .NET Standard 2.0) System.Data.SqlClient available as NuGet package for .NET Standard since v1.2 Not all platforms actually supported it (i.e., old UWP versions) Some database related classes like DataSet were missing

.NET Standard 2.0 SqlClient fully supported on all platforms UWP supports it with the Fall Creators Update DataSet is available (again)

Demo

SQL Server with Linux

Flexible, reliable data management SQL Server on the platform of your choice Windows Linux Support for RedHat Enterprise Linux (RHEL), Ubuntu, and SUSE Enterprise Linux (SLES) Linux and Windows Docker containers Windows Server / Windows 10 Package-based installation: Yum Install, Apt-Get, and Zypper Linux/Windows container Last but not least, customers need flexibility when it comes to the choice of platform, programming languages & data infrastructure to get from the most from their data.   Why? In most IT environments, platforms, technologies and skills are as diverse as they have ever been, the data platform of the future needs to you to build intelligent applications on any data, any platform, any language on premises and in the cloud. SQL Server manages your data, across platforms, with any skills, on-premises & cloud Our goal is to meet you where you are with on any platform, anywhere with the tools and languages of your choice. SQL now has support for Windows, Linux & Docker Containers. It allows you to leverage the language of your choice for advanced analytics – R & Python.

SQL Operations Studio Cross-Platform SQL Server Management Tool

Dapper with .NET Standard

Classing ADO .NET approach

Dapper is a micro OR/M Speed Simplicity Avoiding the ceremony of ADO.NET Speed – OR/M means overhead, a micro OR/M performance will be very close to plain ADO.NET. In my experience, data access is very often the performance bottleneck. YAGNI – OR/Ms ship with a bunch of features that require some extra work that you don’t need, shouldn’t need. OR/Ms often need a significant amount of configuration and setup, especially if you don’t (or can’t) follow conventions. With a Micro OR/M it’s pretty much Install-Package and you’re ready to go. ADO.NET is (was) pretty great, but it shipped with .NET 1.0, that’s like 15 years ago In technology terms, it’s as old as the moon. There is so much ceremony with ADO.NET that it’s just intolerable in many (not all) cases

How it works Sits right on top of ADO.NET Extension methods for IDbConnection We need to write SQL Compatible with .NET Standard 1.3

Demo

References https://docs.microsoft.com/en-us/dotnet/standard/net-standard https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup https://docs.microsoft.com/en-us/sql/sql-operations-studio/what-is https://github.com/StackExchange/Dapper https://github.com/marcominerva/SqlSat707

Thank you. DotNetToscana Dotnettoscana.org @dotnettoscana Marco Minerva - @marcominerva Microsoft MVP – Windows Development https://about.me/marcominerva DotNetToscana Dotnettoscana.org @dotnettoscana