introduction to asp.net and ef core · pdf file24/09/2016 · • uild and run...
Post on 12-Mar-2018
235 Views
Preview:
TRANSCRIPT
Introduction to ASP.NET and EF Core
Md. Mahedee HasanMicrosoft MVP , Visual Studio and Development Technologies
Software Architect, Leadsoft Bangladesh Limited
Trainer, Leads Technology Limited
Microsoft Community Contributor
Blog: http://mahedee.net
MVP | Software Architect | Trainer | Technical Blogger | MCTS
1
• ASP 1996-2000
• Also called classic asp
• Server side scripting to create dynamic content
MAHEDEE.NET2
History of ASP.NET
• ASP.NET 2000 – Present
• First release with .NET framework 1.0
• HTML like mark up to generate dynamic content
• Later version used code behind mode (Clean code)
• Later version introduced– Master Pages and template engine
• Compiled code
MAHEDEE.NET3
History of ASP.NET …
• ASP.NET MVC (2009 – Current)
• Inception in 2007
• Released as open source
• Build on ASP.NET framework uses MVC development Pattern.
• Rezor engine to view generation
• Later version emphasize on multi threading (MVC 5)
MAHEDEE.NET4
History of ASP.NET …
• ASP.NET Web API (2012- Current)
• Introduced with ASP.NET MVC 4
• Created to support RESTful services
• Content negotiation (JSON/XML)
• Supported OData string Queries
MAHEDEE.NET5
History of ASP.NET …
• Platform dependent
• Close source
• Depends only on IIS
• Load unnecessary component when running.
MAHEDEE.NET6
Some Problems before ASP.NET Core
• ASP.NET Core 1.0
• Release 27 June, 2016
• Revolution in ASP.NET Framework
• Open source and cross platform framework
• Intention building modern and cloud applications– Such as web apps, IoT apps and mobile backends.
• ASP.NET Core apps can run on – .NET Core or on the full .NET Framework
MAHEDEE.NET7
Introduction to ASP.NET Core
• Foundational Improvements
• ASP.NET Core is no longer based on System.Web.dll
• It is based on NuGet packages.
• Unify MVC with Web API
• Integration of modern client‐side frameworks
• Built‐in dependency injection (IOC)
MAHEDEE.NET8
Introduction to ASP.NET Core …
• Foundational Improvements …
• No need to compile while developing
• Build and run cross‐platform ASP.NET apps on Windows, Mac and Linux
• Open source and community focused
• New claim based security policy
MAHEDEE.NET9
Introduction to ASP.NET Core …
• Download and Install
• Visual Studio 2015 Update 3
• .NET Core 1.0.0 - VS 2015 Tooling Preview 2
• Install for windows : https://www.microsoft.com/net/core#windows
MAHEDEE.NET10
Installing ASP.NET Core 1.0
• Microsoft SQL Server
• Npgsql (PostgreSQL)
• MySQL (Official)
• Pomelo (MySQL)
• Devart (MySQL, Oracle, PostgreSQL, SQLite, DB2, SQL Server, and more)
• SQLite
• Microsoft SQL Server Compact Edition
• IBM Data Servers
MAHEDEE.NET12
EF Core data provider
• Install Entity Framework• Tools ‣ NuGet Package Manager ‣ Package Manager Console
• Install‐Package Microsoft.EntityFrameworkCore.SqlServer
• Install‐Package Microsoft.EntityFrameworkCore.Tools –Pre
• Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design
• Add Migration Update Database• PM>Add-Migration
• PM>Update-Database
MAHEDEE.NET13
Basic Commands
• Global.asax and App_Start folder is gone !
• Global.json and Project.json is here!
• Src and wwwroot folder is introduced!
• Increases responsibility of Startup.cs
MAHEDEE.NET14
A Quick Look of Application Structure
Creating a Model EF6.x EF Core 1.0.0
Basic modelling (classes, properties, etc.) Yes Yes
Conventions Yes Yes
Custom conventions Yes Partial
Data annotations Yes Yes
Fluent API Yes Yes
Inheritance: Table per hierarchy (TPH) Yes Yes
MAHEDEE.NET16
Feature Comparison
EF Core vs. EF6.x
Creating a Model EF6.x EF Core 1.0.0
Inheritance: Table per type (TPT) Yes
Inheritance: Table per concrete class
(TPC)Yes
Shadow state properties Yes
Alternate keys Yes
Many-to-many: With join entity Yes Yes
Many-to-many: Without join entity Yes
MAHEDEE.NET17
Feature ComparisonEF Core vs. EF6.x
Creating a Model EF6.x EF Core 1.0.0
Key generation: Database Yes Yes
Key generation: Client Yes
Complex/value types Yes
Spatial data Yes
Graphical visualization of model Yes
Graphical drag/drop editor Yes
MAHEDEE.NET18
Feature ComparisonEF Core vs. EF6.x
Creating a Model EF6.x EF Core 1.0.0
Model format: Code Yes Yes
Model format: EDMX (XML) Yes
Reverse engineer model from database:
Command lineYes
Reverse engineer model from database:
VS wizardYes
Incremental update model from
databaseYes
Model format: Code Yes Yes
MAHEDEE.NET19
Feature ComparisonEF Core vs. EF6.x
Querying Data EF6.x EF Core 1.0.0
LINQ: Simple queries Stable Stable
LINQ: Moderate queries Stable Stabilizing
LINQ: Complex queries Stable In-Progress
LINQ: Queries using navigation
propertiesStable In-Progress
“Pretty” SQL generation Poor Yes
Mixed client/server evaluation Yes
MAHEDEE.NET20
Feature ComparisonEF Core vs. EF6.x
Querying Data EF6.x EF Core 1.0.0
Loading related data: Eager Yes Yes
Loading related data: Lazy Yes
Loading related data: Explicit Yes
Raw SQL queries: Model types Yes Yes
Raw SQL queries: Un-mapped types Yes
Raw SQL queries: Composing with LINQ Yes
MAHEDEE.NET21
Feature ComparisonEF Core vs. EF6.x
Saving Data EF6.x EF Core 1.0.0
SaveChanges Yes Yes
Change tracking: Snapshot Yes Yes
Change tracking: Notification Yes Yes
Accessing tracked state Yes Partial
Optimistic concurrency Yes Yes
Transactions Yes Yes
MAHEDEE.NET22
Feature ComparisonEF Core vs. EF6.x
Saving Data EF6.x EF Core 1.0.0
Batching of statements Yes
Stored procedure Yes
Detached graph support (N-Tier): Low
level APIsPoor Yes
Detached graph support (N-Tier): End-to-
endPoor
MAHEDEE.NET23
Feature ComparisonEF Core vs. EF6.x
Other Features EF6.x EF Core 1.0.0
Migrations Yes Yes
Database creation/deletion APIs Yes Yes
Seed data Yes
Connection resiliency Yes
Lifecycle hooks (events, command
interception, ...)Yes
MAHEDEE.NET24
Feature ComparisonEF Core vs. EF6.x
MAHEDEE.NET25
Feature ComparisonEF Core vs. EF6.x
Application Models EF6.x EF Core 1.0.0
WinForms Yes Yes
WPF Yes Yes
Console Yes Yes
ASP.NET Yes Yes
ASP.NET Core Yes
Xamarin Coming soon 2
UWP Yes
• Porting from EF6.x to EF Core
• https://docs.efproject.net/en/latest/efcore-vs-ef6/porting/
• Migrating From ASP.NET MVC to ASP.NET Core MVC
• https://docs.asp.net/en/latest/migration/mvc.html
MAHEDEE.NET26
Migration or Porting
• If any questions ASP.NET, IIS, .NET Framework, C#, SQL Sever and Design Pattern, search here:http://mahedee.net
• Email me:
mahedee.hasan@gmail.com; Mahedee_hasan@leads-bd.com
• Tag me in facebook group post
• https://www.facebook.com/groups/mstech.bd
• https://www.facebook.com/groups/techshareonline/
MAHEDEE.NET28
Q&A
• All slides, Including some training slide here
http://www.slideshare.net/mahedee19
• Me in Facebook:
https://facebook.com/mahedee19
• Me in Linkedin:
https://www.linkedin.com/in/mahedee
MAHEDEE.NET29
Q&A
top related