DevIntersections 2014 Web API Slides

16
Building Restful Services by Using ASP.NET WebAPI & Entity Framework Brady Gaster [email protected] @bradygaster bradygaster.com

description

This deck is the one I used at DevIntersections 2014 in Orlando for my Web API talk.

Transcript of DevIntersections 2014 Web API Slides

Page 1: DevIntersections 2014 Web API Slides

DEVintersection

Building Restful Services by UsingASP.NET WebAPI & Entity Framework

Brady [email protected]

@bradygasterbradygaster.com

Page 2: DevIntersections 2014 Web API Slides

2© DEVintersection. All rights reserved.

http://www.DEVintersection.com

Introduction

Overview New features in Entity Framework 6 Enabling and Running Entity Framework Migrations Using Entity Framework to Update Database Structure New features in ASP.NET Web API Scaffolding Web API using new Visual Studio 2013 Features Fixing Common Web API Serialization & Circular Reference

Issues Web API & OData (and LinqPad for good measure!) Accessing Web APIs from Native Code Accessing Web APIs from HTML

Questions Let’s hold them until the end, as there’ll be time for discussion

Page 3: DevIntersections 2014 Web API Slides

Demo

Reverse-engineering a Database to Code First Entities

Page 4: DevIntersections 2014 Web API Slides

Demo

Enabling and Running EF Migrations

Page 5: DevIntersections 2014 Web API Slides

Demo

Updating Table Structure using EF Migrations

Page 6: DevIntersections 2014 Web API Slides

Demo

A New Web API Help Page

Page 7: DevIntersections 2014 Web API Slides

Demo

Controlling Your Web API Formatters

Page 8: DevIntersections 2014 Web API Slides

Demo

Scaffolding a Web API Controller from an EF Entity

Page 9: DevIntersections 2014 Web API Slides

Demo

Mitigating Circular References

Page 10: DevIntersections 2014 Web API Slides

Demo

Scaffolding a Web API OData Controller

Page 11: DevIntersections 2014 Web API Slides

Demo

Querying OData

Page 12: DevIntersections 2014 Web API Slides

Demo

Accessing a REST Endpoint from Native Code

Page 13: DevIntersections 2014 Web API Slides

Demo

Accessing a REST Endpoint from HTML

Page 14: DevIntersections 2014 Web API Slides

14© DEVintersection. All rights reserved.

http://www.DEVintersection.com

Final Comments

Web API is REST on ASP.NET Entity Framework 6.1

Code First Generation from Existing Databases Need to reference EF 6.1 in your project to enable the tooling

Web API Configuration Pick your formatters wisely, according to needs Use JSON.NET and EF attributes to control de/serialization New scaffolding features in VS 2013 make life easier

Page 15: DevIntersections 2014 Web API Slides

15© DEVintersection. All rights reserved.

http://www.DEVintersection.com

References

Web API on ASP.NEThttp://www.asp.net/web-api

Entity Framework on MSDNhttp://msdn.microsoft.com/en-us/data/ef.aspx

Visual Studio Toolbox on Channel 9http://channel9.msdn.com/Shows/Visual-Studio-Toolbox

Page 16: DevIntersections 2014 Web API Slides

Questions?

Thank you!

Don’t forget to enter your evaluation of this session using EventBoard!