06 | Integrating extra features and looking forward

Slides:



Advertisements
Similar presentations
Introduction to NHibernate By Andrew Smith. The Basics Object Relation Mapper Maps POCOs to database tables Based on Java Hibernate. V stable Generates.
Advertisements

Getting Started with Oracle and .NET
Jeff Derstadt Senior Development Lead Microsoft Corporation Patterns & Architecture.
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
SQL Forms Engine Koifman Eran Egri Ozi Supervisor: Ilana David.
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Entity Framework Code First End to End
Database Design for DNN Developers Sebastian Leupold.
Meir Botner David Ben-David. Project Goal Build a messenger that allows a customer to communicate with a service provider for a fee.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
Computer Measurement Group, India Optimal Design Principles for better Performance of Next generation Systems Balachandar Gurusamy,
Part 04 – Preparing to Deploy to the Cloud Entity Framework and MVC Series Tom Perkins NTPCUG.
Ronnie Saurenmann Principal Architect Microsoft Switzerland.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Entity Framework Code First – Beyond the Basics Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant.
Virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft
All information's of PLINQO in this Document, I got it from: So, you could visit the link above to research.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Entity Framework 7 Who Are You & What Have You Done to my ORM?
Entity Framework 7: What’s New? Ricardo Peres Technical Evangelist at Simplifydigital. Microsoft
Technology Drill Down: Windows Azure Platform Eric Nelson | ISV Application Architect | Microsoft UK |
03 | Developing MVC 4 Controllers Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
Stanislaus County Employee Access DataStore Application Presented By: Melanie Lema, Information Technology Unit Stanislaus County Department of Child.
Explore engage elevate Data Migration Without Tears Mike Feingold Empoint Ltd Tuesday 10th November 2015.
Thank you to our AWESOME sponsors!
ASP.NET Core* Shahed Chowdhuri Sr. Technical WakeUpAndCode.com A Quick Overview of ASP.NET Core * aka ASP.NET 5 before.
MVC 4.0, Knockout.js, Bootstrap and EF6.0 FAST, FLEXIBLE AND RESPONSIVE QUICK TO MARKET WEBSITES.
Introduction The concept of a web framework originates from the basic idea that every web application obtains its foundations from a similar set of guidelines.
Top 10 Entity Framework Features Every Developer Should Know
New Technology: Why, What ,How
Introduction to Entity framework
Introduction to .NET Florin Olariu
Introduction to Entity Framework
EF Advanced Querying Optimize Performance SoftUni Team Advanced
Data Virtualization Tutorial: Introduction to SQL Script
Entity Framework 6 New Features
Nicho Joins Microsoft Azure Certified Program to Transform Brand Engagement, Boost Customer Acquisition and Conversions with Scalable Ease MICROSOFT AZURE.
Dealing with Entity Framework
Best Practices and Architecture
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Server Concepts Dr. Charles W. Kann.
Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek
Web Applications Security What are web Applications?
Haritha Dasari Josue Balandrano Coronel -
Entity Framework By: Casey Griffin.
Entity Framework Advanced Querying SoftUni Team Technical Trainers
Entity Framework Core for Enterprise Applications
Yii - For the Future - Gen Web Development Platform
Learn. Imagine. Build. .NET Conf
SharePoint Cloud hosted Apps
ADO.NET Entity Framework
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
Django in the real world
Web Development Using ASP .NET
Lecture 1: Multi-tier Architecture Overview
Entity Framework Core (EF Core)
Chapter 15 Introduction to Rails.
ASP.NET Module Subtitle.
Jeff Webb Maria Baron Chris Hundersmarck
Using Visual Studio Visual Studio භාවිතය
SQL .. An overview lecture3.
Entity Framework Core for Enterprise Applications
Implementing Entity Framework with MVC Jump Start
ASP.NET Authentication with Identity Jump Start
02 | Beginning Code First Adam Tuliper | Technical Evangelist
Map Reduce, Types, Formats and Features
Presentation transcript:

06 | Integrating extra features and looking forward Christopher Harrison | Content Developer, Microsoft Adam Tuliper | Technical Evangelist, Microsoft

Module Overview Stored procedures Increasing user experience with concurrency detection A few best practices Looking forward with Entity Framework 7

Stored procedures

Store procedures Why use stored procedures? Limits dynamic sql Single point to secure – easier permissions Know exactly how DB is being queries Limits dynamic sql Still possible with sprocs, just more manual effort In general performance is _not_ a reason Virtually the same as sql query (pendulum swings both ways)

Stored procedures Support came as XX In the past could simply Database.SqlQuery Could map in the designer (which is going away) Code first will generate procedures context.Database.SqlQuery<myEntityType>( "mySpName @param1, @param2, @param3", new SqlParameter("param1", param1), new SqlParameter("param2", param2), new SqlParameter("param3", param3) );

Integrating stored procedures

Increasing user experience with concurrency detection

Concurrency As Chris showed, easy to implement via concurrency token [TimeStamp] modelBuilder.Entity<YourEntity>() .Property(e => e.Timestamp) .IsRowVersion(); Change detection can be enhanced via MVC Action Filters Let’s give the user the choice on how to proceed

Concurrency detection and user choice

A few best practices

Helpful hints in a web world Since the web layers (controller to view) are disconnected Always convert results to IEnumerable via .ToList() Ex. context.Albums.Where(o=>o.Title.Contains(search).ToList() Disable lazy loading in web environments context.Configuration.LazyLoadingEnabled = false; Use .Include to load related entities DbContext is not thread safe. Do not cache it! Always dispose DbContext when done

Context lifetime When context is gone, connection is gone Can’t (and shouldn’t) use connection from MVC view Get data, send to view Always execute result set when needed before exiting using() using (var context = new MusicContext()) { var albums = context.Albums .Where(o=>o.Title.Contains(search)) .ToList()); return View(albums); }

Watch out for… If you have two+ context classes One from selecting auth during app creation (Identity) One for your other entities Migrations should specify separate folders Enable-Migrations –MigrationsDirectory IdentityMigrations Enable-Migrations –MigrationsDirectory MusicStoreMigrations For complex joins, keep an eye on queries Doing lots of inserts? AutoDetectChangesEnabled = false;

Async when appropriate EF supports async queries Async allows current thread to be used elsewhere Useful in case of network, db delays (long operations) Although not all the time, caution of overloading db public async Task<ActionResult> Create(…) { if (ModelState.IsValid) db.Albums.Add(album); await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(album);

Consider Connection resiliency This is a connection retry policy Works great with async Four modes DefaultExecutionStrategy DefaultSqlExecutionStrategy DbExecutionStrategy SqlAzureExecutionStrategy throws RetryLimitExceededException

Connection Resiliency & Async

Looking forward with Entity Framework 7

Notable new features Designer has been removed Code first only Rewritten from ground up with performance in mind New platforms New data stores In memory database Update-Database now split Apply-Migration Script-Migration

EF 7 Quick Tour

Resources Additional patterns Reducing Code First Database Chatter http://www.asp.net/mvc/overview/older-versions/getting-started-with- ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work- patterns-in-an-asp-net-mvc-application Reducing Code First Database Chatter http://romiller.com/2014/06/10/reducing-code-first-database-chatter/ EF7 Project home https://github.com/aspnet/EntityFramework