Entity Framework for Cross platform apps
-
Upload
svswaminathan -
Category
Technology
-
view
1.313 -
download
0
Transcript of Entity Framework for Cross platform apps
![Page 1: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/1.jpg)
EF For Cross Platform Apps@svswaminathan
BDotNet UG Meet, Aug 2016
![Page 2: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/2.jpg)
Swaminathan Vetri
• Senior Engineer @ Target
• Microsoft MVP - Visual Studio & Development technologies
• Windows/Web/Cross platform mobile developer
• Blogger, Speaker, Amateur photographer, Gadget freak
2
![Page 3: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/3.jpg)
Objective
• What is EF Core ?
• Why EF Core ?
• What it offers ?
• EF Core vs EF 6.x
• Demos
![Page 4: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/4.jpg)
What is EF Core ?
• Entity Framework (EF) Core is an object-relational mapper (O/RM) that enables .NET developers to work with a database using .NET objects.
• EF Core is a lightweight and extensible version of the popular Entity Framework data access technology.
![Page 5: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/5.jpg)
Why EF Core ?
• Cross platform i.e., EF Core works on Windows/Mac/Linux
• Lightweight and Composable
• Supports new data stores (relational & non-relational)
• Multiple Database providers
• Optimized around being a simple intuitive O/RM
![Page 6: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/6.jpg)
What it offers?
• Modelling
• Change Tracking
• SaveChanges
• Querying
• Database Schema Management
• Database Providers
• Platforms
![Page 7: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/7.jpg)
Modelling
• Basic modelling• Built in conventions• Fluent API• Data Annotations• Relationships• Shadow state properties• Model validation• Key Value generation• Relational : Table mapping• TPH inheritance
![Page 8: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/8.jpg)
Change Tracking
• Snapshot change tracking
• Notification change tracking
• Accessing tracked state • Via DbContext.Entry/DbContext.ChangeTracker
• Attaching detached entities/graphs • Via DbContext.AttachGraph API
![Page 9: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/9.jpg)
Save Changes
• Basic Save
• Optimistic Concurrency
• Async Save changes
• Transactions
• Relational : Batching of statements
![Page 10: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/10.jpg)
Querying
• LINQ Support
• Mixed client/server evaluation
• NoTracking
• Eager loading
• Async Query
• Raw SQL Queries• Via DbSet.FromSql
![Page 11: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/11.jpg)
Database Schema Management
• Database Creation/Deletion
• Relational Database migration
• Reverse Engineer from Database
![Page 12: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/12.jpg)
Database Providers
• Microsoft SqlServer – connects to SQL server 2008 onwards
• Microsoft SqlServer Compact edition
• IBM data servers
• Sqlite
• InMemory
• Postgres
• MySQL, Oracle (Coming soon)
![Page 13: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/13.jpg)
Platforms
• Full .Net• Console, WPF, WinForms, ASP.NET 4
• .Net Core• Asp.Net Core on Windows, Linux and OS X
• UWP
![Page 14: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/14.jpg)
EF Core vs EF 6.x
![Page 15: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/15.jpg)
What’s new in EF Core ?
• Support for UWP, Asp.Net Core, Xamarin (coming soon)
• Database providers like InMemory, Azure Table storage, Redis etc.,
• Reverse engineer model from command line (Scaffold-DbContext)
• Shadow state properties
• Alternate Keys, Key generation at Client
• Mixed client/server evaluation
• Batching of statements (only relational)
![Page 16: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/16.jpg)
What’s NOT available in EF Core ?
• Inheritance (Table per type, Table per concrete class)
• Many to many without join entities
• Complex/value types, Spatial data, graphical visualization of model, Drag and drop editor, EDMX
• Reverse engineer from database (VS Wizard), Incremental model update from DB
• Lazy loading, explicit loading, Stored Procedure
• Seed data, Connection resiliency, lifecycle hooks (events, command interception etc.,)
![Page 17: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/17.jpg)
Demo
![Page 18: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/18.jpg)
Useful links
• https://github.com/aspnet/EntityFramework/wiki/Roadmap
• https://github.com/aspnet/EntityFramework/wiki/Guiding-Principles
• https://docs.efproject.net/en/latest/intro.html
• https://docs.efproject.net/en/latest/efcore-vs-ef6/features.html#side-by-side-comparison
![Page 19: Entity Framework for Cross platform apps](https://reader036.fdocuments.net/reader036/viewer/2022071711/58edc9bc1a28abb12e8b4669/html5/thumbnails/19.jpg)
Thank YouQuestions/Feedbacks : [email protected] | @svswaminathan