SlideShare a Scribd company logo
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?
– 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 in EF 6
– Only Fluent API based
• In the past could use procs manually
– var album = Database.SqlQuery<TriviaOption>("dbo.Proc….");
• Could map in the designer (which is going away)
• Code first will generate procedures for
– Insert, Delete, Update
• Wait – why no Select?
DEMODEMO
Integrating stored procedures
Increasing user experience with
concurrency detection
Concurrency
• As Christopher 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
DEMODEMO
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
– context.Albums.Include(o=>o.AlbumDetails)
• 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…
• For complex joins, keep an eye on queries
– Remember context.Database.Log = s => Debug.WriteLine(s);
• Doing lots of inserts? AutoDetectChangesEnabled = false;
– EF detects changes on add to context and on save
– Can turn off and on again in same context lifetime
{
context.Configuration.AutoDetectChangesEnabled = false;
Do something
context.Configuration.AutoDetectChangesEnabled = true;
}
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
DEMODEMO
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
– Linux, OSX, Mono, Windows Phone*, Windows Store*
• New data stores
• In memory database
• Update-Database now split
– Apply-Migration
– Script-Migration
Resources
• Additional patterns
– 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
©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the
U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft
must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the
U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft
must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Ad

More Related Content

What's hot (20)

Oracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & TricksOracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & Tricks
Jeff Smith
 
PHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the code
Michal Juhas
 
PL/SQL Guilty Pleasures
PL/SQL Guilty PleasuresPL/SQL Guilty Pleasures
PL/SQL Guilty Pleasures
Steven Feuerstein
 
AskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQLAskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQL
Steven Feuerstein
 
Test Driven Development in AEM/CQ5
Test Driven Development in AEM/CQ5Test Driven Development in AEM/CQ5
Test Driven Development in AEM/CQ5
rtpaem
 
Take Full Advantage of the Oracle PL/SQL Compiler
Take Full Advantage of the Oracle PL/SQL CompilerTake Full Advantage of the Oracle PL/SQL Compiler
Take Full Advantage of the Oracle PL/SQL Compiler
Steven Feuerstein
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxDSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
Mikalai Alimenkou
 
Introducing domain driven design - dogfood con 2018
Introducing domain driven design - dogfood con 2018Introducing domain driven design - dogfood con 2018
Introducing domain driven design - dogfood con 2018
Steven Smith
 
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and More
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and MoreUnit Testing Oracle PL/SQL Code: utPLSQL, Excel and More
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and More
Steven Feuerstein
 
Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)
CISPA Helmholtz Center for Information Security
 
Using The Page Object Pattern
Using The Page Object PatternUsing The Page Object Pattern
Using The Page Object Pattern
Dante Briones
 
Improving the Design of Existing Software
Improving the Design of Existing SoftwareImproving the Design of Existing Software
Improving the Design of Existing Software
Steven Smith
 
Automated Acceptance Tests in .NET
Automated Acceptance Tests in .NETAutomated Acceptance Tests in .NET
Automated Acceptance Tests in .NET
Wyn B. Van Devanter
 
Software development fundamentals
Software development fundamentalsSoftware development fundamentals
Software development fundamentals
Alfred Jett Grandeza
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
Steven Smith
 
OLD APEX and PL/SQL
OLD APEX and PL/SQLOLD APEX and PL/SQL
OLD APEX and PL/SQL
Steven Feuerstein
 
Test Driven Development in CQ5/AEM
Test Driven Development in CQ5/AEMTest Driven Development in CQ5/AEM
Test Driven Development in CQ5/AEM
Sagar Sane
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Steven Smith
 
Most Useful Design Patterns
Most Useful Design PatternsMost Useful Design Patterns
Most Useful Design Patterns
Steven Smith
 
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Steven Smith
 
Oracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & TricksOracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & Tricks
Jeff Smith
 
PHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the code
Michal Juhas
 
AskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQLAskTOM Office Hours - Dynamic SQL in PL/SQL
AskTOM Office Hours - Dynamic SQL in PL/SQL
Steven Feuerstein
 
Test Driven Development in AEM/CQ5
Test Driven Development in AEM/CQ5Test Driven Development in AEM/CQ5
Test Driven Development in AEM/CQ5
rtpaem
 
Take Full Advantage of the Oracle PL/SQL Compiler
Take Full Advantage of the Oracle PL/SQL CompilerTake Full Advantage of the Oracle PL/SQL Compiler
Take Full Advantage of the Oracle PL/SQL Compiler
Steven Feuerstein
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptxDSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
Mikalai Alimenkou
 
Introducing domain driven design - dogfood con 2018
Introducing domain driven design - dogfood con 2018Introducing domain driven design - dogfood con 2018
Introducing domain driven design - dogfood con 2018
Steven Smith
 
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and More
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and MoreUnit Testing Oracle PL/SQL Code: utPLSQL, Excel and More
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and More
Steven Feuerstein
 
Using The Page Object Pattern
Using The Page Object PatternUsing The Page Object Pattern
Using The Page Object Pattern
Dante Briones
 
Improving the Design of Existing Software
Improving the Design of Existing SoftwareImproving the Design of Existing Software
Improving the Design of Existing Software
Steven Smith
 
Automated Acceptance Tests in .NET
Automated Acceptance Tests in .NETAutomated Acceptance Tests in .NET
Automated Acceptance Tests in .NET
Wyn B. Van Devanter
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
Steven Smith
 
Test Driven Development in CQ5/AEM
Test Driven Development in CQ5/AEMTest Driven Development in CQ5/AEM
Test Driven Development in CQ5/AEM
Sagar Sane
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Steven Smith
 
Most Useful Design Patterns
Most Useful Design PatternsMost Useful Design Patterns
Most Useful Design Patterns
Steven Smith
 
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Steven Smith
 

Viewers also liked (20)

05 managing transactions
05   managing transactions05   managing transactions
05 managing transactions
Марина Босова
 
03 managing relationships
03   managing relationships03   managing relationships
03 managing relationships
Марина Босова
 
01 introduction to entity framework
01   introduction to entity framework01   introduction to entity framework
01 introduction to entity framework
Марина Босова
 
02 beginning code first
02   beginning code first02   beginning code first
02 beginning code first
Марина Босова
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
Emertxe Information Technologies Pvt Ltd
 
000 introduction
000 introduction000 introduction
000 introduction
sivorka
 
001 hosting
001 hosting001 hosting
001 hosting
sivorka
 
презентация привязка модели и валидация данных
презентация   привязка модели и валидация данныхпрезентация   привязка модели и валидация данных
презентация привязка модели и валидация данных
sivorka
 
навигация и валидаторы презентация
навигация и валидаторы   презентациянавигация и валидаторы   презентация
навигация и валидаторы презентация
sivorka
 
05 cерверные элементы управления презентация
05 cерверные элементы управления   презентация05 cерверные элементы управления   презентация
05 cерверные элементы управления презентация
sivorka
 
Mva stf module 6 - rus
Mva stf module 6 - rusMva stf module 6 - rus
Mva stf module 6 - rus
Maxim Shaptala
 
Mva stf module 5 - rus
Mva stf module 5 - rusMva stf module 5 - rus
Mva stf module 5 - rus
Maxim Shaptala
 
Testing po
Testing poTesting po
Testing po
Marina Bosova
 
Mva stf module 1 - rus
Mva stf module 1 - rusMva stf module 1 - rus
Mva stf module 1 - rus
Maxim Shaptala
 
Mva stf module 3 - rus
Mva stf module 3 - rusMva stf module 3 - rus
Mva stf module 3 - rus
Maxim Shaptala
 
Mva stf module 4 - rus
Mva stf module 4 - rusMva stf module 4 - rus
Mva stf module 4 - rus
Maxim Shaptala
 
Mva stf module 2 - rus
Mva stf module 2 - rusMva stf module 2 - rus
Mva stf module 2 - rus
Maxim Shaptala
 
Getting started with angular js
Getting started with angular jsGetting started with angular js
Getting started with angular js
Maurice De Beijer [MVP]
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Siva Arunachalam
 
Team Foundation Server Process Templates For Effective Project Management
Team Foundation Server Process Templates For Effective Project ManagementTeam Foundation Server Process Templates For Effective Project Management
Team Foundation Server Process Templates For Effective Project Management
Aaron Bjork
 
000 introduction
000 introduction000 introduction
000 introduction
sivorka
 
001 hosting
001 hosting001 hosting
001 hosting
sivorka
 
презентация привязка модели и валидация данных
презентация   привязка модели и валидация данныхпрезентация   привязка модели и валидация данных
презентация привязка модели и валидация данных
sivorka
 
навигация и валидаторы презентация
навигация и валидаторы   презентациянавигация и валидаторы   презентация
навигация и валидаторы презентация
sivorka
 
05 cерверные элементы управления презентация
05 cерверные элементы управления   презентация05 cерверные элементы управления   презентация
05 cерверные элементы управления презентация
sivorka
 
Mva stf module 6 - rus
Mva stf module 6 - rusMva stf module 6 - rus
Mva stf module 6 - rus
Maxim Shaptala
 
Mva stf module 5 - rus
Mva stf module 5 - rusMva stf module 5 - rus
Mva stf module 5 - rus
Maxim Shaptala
 
Mva stf module 1 - rus
Mva stf module 1 - rusMva stf module 1 - rus
Mva stf module 1 - rus
Maxim Shaptala
 
Mva stf module 3 - rus
Mva stf module 3 - rusMva stf module 3 - rus
Mva stf module 3 - rus
Maxim Shaptala
 
Mva stf module 4 - rus
Mva stf module 4 - rusMva stf module 4 - rus
Mva stf module 4 - rus
Maxim Shaptala
 
Mva stf module 2 - rus
Mva stf module 2 - rusMva stf module 2 - rus
Mva stf module 2 - rus
Maxim Shaptala
 
Team Foundation Server Process Templates For Effective Project Management
Team Foundation Server Process Templates For Effective Project ManagementTeam Foundation Server Process Templates For Effective Project Management
Team Foundation Server Process Templates For Effective Project Management
Aaron Bjork
 
Ad

Similar to 06 integrating extra features and looking forward (20)

Getting Started with Sql Server Compact Edition
Getting Started with Sql Server Compact EditionGetting Started with Sql Server Compact Edition
Getting Started with Sql Server Compact Edition
DonRobins
 
Getting Started with SQL Server Compact Edition 3.51
Getting Started with SQL Server Compact Edition 3.51Getting Started with SQL Server Compact Edition 3.51
Getting Started with SQL Server Compact Edition 3.51
Mark Ginnebaugh
 
Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501
Tjarda Peelen
 
01 overview-and-setup
01 overview-and-setup01 overview-and-setup
01 overview-and-setup
snopteck
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
Joram Salinas
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
michaelaaron25322
 
Ebook9
Ebook9Ebook9
Ebook9
kaashiv1
 
Ebook9
Ebook9Ebook9
Ebook9
kaashiv1
 
Sql interview-question-part-9
Sql interview-question-part-9Sql interview-question-part-9
Sql interview-question-part-9
kaashiv1
 
Sql interview question part 9
Sql interview question part 9Sql interview question part 9
Sql interview question part 9
kaashiv1
 
Twelve Factor - Designing for Change
Twelve Factor - Designing for ChangeTwelve Factor - Designing for Change
Twelve Factor - Designing for Change
Eric Wyles
 
Integration-Monday-Terraform-Serverless
Integration-Monday-Terraform-ServerlessIntegration-Monday-Terraform-Serverless
Integration-Monday-Terraform-Serverless
BizTalk360
 
Oracle Database Cloud Service
Oracle Database Cloud ServiceOracle Database Cloud Service
Oracle Database Cloud Service
Jean-Philippe PINTE
 
KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under Control
Coimbra JUG
 
Dev Ops for systems of record - Talk at Agile Australia 2015
Dev Ops for systems of record - Talk at Agile Australia 2015Dev Ops for systems of record - Talk at Agile Australia 2015
Dev Ops for systems of record - Talk at Agile Australia 2015
Mirco Hering
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
mohamedsamirgalal
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
mohamedsamirgalal
 
Standardizing and Managing Your Infrastructure - MOSC 2011
Standardizing and Managing Your Infrastructure - MOSC 2011Standardizing and Managing Your Infrastructure - MOSC 2011
Standardizing and Managing Your Infrastructure - MOSC 2011
Brian Ritchie
 
01 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv101 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv1
Ivan Ma
 
Impact of cloud services on the work of oracle technology experts
Impact of cloud services on the work of oracle technology expertsImpact of cloud services on the work of oracle technology experts
Impact of cloud services on the work of oracle technology experts
Andreas Chatziantoniou
 
Getting Started with Sql Server Compact Edition
Getting Started with Sql Server Compact EditionGetting Started with Sql Server Compact Edition
Getting Started with Sql Server Compact Edition
DonRobins
 
Getting Started with SQL Server Compact Edition 3.51
Getting Started with SQL Server Compact Edition 3.51Getting Started with SQL Server Compact Edition 3.51
Getting Started with SQL Server Compact Edition 3.51
Mark Ginnebaugh
 
Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501
Tjarda Peelen
 
01 overview-and-setup
01 overview-and-setup01 overview-and-setup
01 overview-and-setup
snopteck
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
michaelaaron25322
 
Sql interview-question-part-9
Sql interview-question-part-9Sql interview-question-part-9
Sql interview-question-part-9
kaashiv1
 
Sql interview question part 9
Sql interview question part 9Sql interview question part 9
Sql interview question part 9
kaashiv1
 
Twelve Factor - Designing for Change
Twelve Factor - Designing for ChangeTwelve Factor - Designing for Change
Twelve Factor - Designing for Change
Eric Wyles
 
Integration-Monday-Terraform-Serverless
Integration-Monday-Terraform-ServerlessIntegration-Monday-Terraform-Serverless
Integration-Monday-Terraform-Serverless
BizTalk360
 
KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under Control
Coimbra JUG
 
Dev Ops for systems of record - Talk at Agile Australia 2015
Dev Ops for systems of record - Talk at Agile Australia 2015Dev Ops for systems of record - Talk at Agile Australia 2015
Dev Ops for systems of record - Talk at Agile Australia 2015
Mirco Hering
 
Standardizing and Managing Your Infrastructure - MOSC 2011
Standardizing and Managing Your Infrastructure - MOSC 2011Standardizing and Managing Your Infrastructure - MOSC 2011
Standardizing and Managing Your Infrastructure - MOSC 2011
Brian Ritchie
 
01 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv101 demystifying mysq-lfororacledbaanddeveloperv1
01 demystifying mysq-lfororacledbaanddeveloperv1
Ivan Ma
 
Impact of cloud services on the work of oracle technology experts
Impact of cloud services on the work of oracle technology expertsImpact of cloud services on the work of oracle technology experts
Impact of cloud services on the work of oracle technology experts
Andreas Chatziantoniou
 
Ad

Recently uploaded (20)

How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 

06 integrating extra features and looking forward

  • 1. 06 | Integrating extra features and looking forward Christopher Harrison | Content Developer, Microsoft Adam Tuliper | Technical Evangelist, Microsoft
  • 2. Module Overview • Stored procedures • Increasing user experience with concurrency detection • A few best practices • Looking forward with Entity Framework 7
  • 4. Store procedures • Why use stored procedures? – 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)
  • 5. Stored procedures • Support came in EF 6 – Only Fluent API based • In the past could use procs manually – var album = Database.SqlQuery<TriviaOption>("dbo.Proc…."); • Could map in the designer (which is going away) • Code first will generate procedures for – Insert, Delete, Update • Wait – why no Select?
  • 7. Increasing user experience with concurrency detection
  • 8. Concurrency • As Christopher 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
  • 10. A few best practices
  • 11. 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 – context.Albums.Include(o=>o.AlbumDetails) • DbContext is not thread safe. Do not cache it! – Always dispose DbContext when done
  • 12. 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); }
  • 13. Watch out for… • For complex joins, keep an eye on queries – Remember context.Database.Log = s => Debug.WriteLine(s); • Doing lots of inserts? AutoDetectChangesEnabled = false; – EF detects changes on add to context and on save – Can turn off and on again in same context lifetime { context.Configuration.AutoDetectChangesEnabled = false; Do something context.Configuration.AutoDetectChangesEnabled = true; }
  • 14. 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); }
  • 15. Consider Connection resiliency • This is a connection retry policy • Works great with async • Four modes – DefaultExecutionStrategy – DefaultSqlExecutionStrategy – DbExecutionStrategy – SqlAzureExecutionStrategy • throws RetryLimitExceededException
  • 17. Looking forward with Entity Framework 7
  • 18. Notable new features • Designer has been removed – Code First Only • Rewritten from ground up with performance in mind • New platforms – Linux, OSX, Mono, Windows Phone*, Windows Store* • New data stores • In memory database • Update-Database now split – Apply-Migration – Script-Migration
  • 19. Resources • Additional patterns – 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
  • 20. ©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. ©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Editor's Notes

  • #2: 1
  • #7: modelBuilder    .Entity<Album>()    .MapToStoredProcedures(); modelBuilder     .Entity<Album>()     .MapToStoredProcedures(s =>       s.Update(u => u.HasName(“Blog_"))        .Delete(d => d.HasName("delete_blog"))        .Insert(i => i.HasName("insert_blog"))); modelBuilder.Entity<TriviaOption>().MapToStoredProcedures(p => p.Insert(proc => proc.HasName("Proc_AddAlbum") .Result(r => r.Id,"id")));
  • #15: ToListAsync await db.SaveChangesAsync public async Task<ActionResult> Return task [HttpPost] [ValidateAntiForgeryToken] public async Task<ActionResult> Create([Bind(Include = "AlbumId,GenreId,ArtistId,Title,Price,AlbumArtUrl")] Album album) { if (ModelState.IsValid) { db.Albums.Add(album); await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(album); }
  • #16: https://code.msdn.microsoft.com/ASPNET-MVC-Application-b01a9fe8
  • #17: Change method to be async for save