entity framework for cross platform apps
TRANSCRIPT
EF For Cross Platform Apps@svswaminathan
BDotNet UG Meet, Aug 2016
Swaminathan Vetri
• Senior Engineer @ Target
• Microsoft MVP - Visual Studio & Development technologies
• Windows/Web/Cross platform mobile developer
• Blogger, Speaker, Amateur photographer, Gadget freak
2
Objective
• What is EF Core ?
• Why EF Core ?
• What it offers ?
• EF Core vs EF 6.x
• Demos
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.
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
What it offers?
• Modelling
• Change Tracking
• SaveChanges
• Querying
• Database Schema Management
• Database Providers
• Platforms
Modelling
• Basic modelling• Built in conventions• Fluent API• Data Annotations• Relationships• Shadow state properties• Model validation• Key Value generation• Relational : Table mapping• TPH inheritance
Change Tracking
• Snapshot change tracking
• Notification change tracking
• Accessing tracked state • Via DbContext.Entry/DbContext.ChangeTracker
• Attaching detached entities/graphs • Via DbContext.AttachGraph API
Save Changes
• Basic Save
• Optimistic Concurrency
• Async Save changes
• Transactions
• Relational : Batching of statements
Querying
• LINQ Support
• Mixed client/server evaluation
• NoTracking
• Eager loading
• Async Query
• Raw SQL Queries• Via DbSet.FromSql
Database Schema Management
• Database Creation/Deletion
• Relational Database migration
• Reverse Engineer from Database
Database Providers
• Microsoft SqlServer – connects to SQL server 2008 onwards
• Microsoft SqlServer Compact edition
• IBM data servers
• Sqlite
• InMemory
• Postgres
• MySQL, Oracle (Coming soon)
Platforms
• Full .Net• Console, WPF, WinForms, ASP.NET 4
• .Net Core• Asp.Net Core on Windows, Linux and OS X
• UWP
EF Core vs EF 6.x
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)
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.,)
Demo
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
Thank YouQuestions/Feedbacks : [email protected] | @svswaminathan