Learn how to build real world nTier applications with the Entity Framework and related services. With this new technology built into .NET, you can easily wrap an object model around your database and have all the data access automatically generated or use your own stored procedures and views. Then learn how to easily and securely expose your object model using WCF with just a few line of code using ADO.NET Data Services. The session will demonstrate how to create and consume these new technologies from the ground up.
3. dotNetDave Conference DVD! Packed full of: Videos of all sessions from 2010 & 2011(1)! Slide decks from 2011 & 2010! Demo projects from 2011 & 2010! David McCarter’s .NET interview Questions! Extras Conference Photos from 2010! Surprise videos! Book + DVD $25! Only $15!
4. Check Out Your Local User Groups! San Diego Cloud Computing User Group www.azureusergroup.com/group/sandiegoazureusergroup San Diego .NET Developers Group www.sddotnetdg.org San Diego .NET User Group www.sandiegodotnet.com San Diego SQL Server User Group www.sdsqlug.org
7. Where’s Your Data Model? Applications Today… Implicitly Contain the Data Model Logic and Model Intertwined Conceptual Mismatch Often encapsulate in a "Data Access Layer"
15. Object Relational Mapping What is ORM? Technique for working with relational tables as if they were objects in memory Intention is to hide away the complexity of the underlying tables and give a uniform way of working with data
17. Many attempts Typed Datasets Objectspaces ‘v1’ Objectspaces ‘v2’ Microsoft Business Framework WinFS Linq to SQL NHibernate Will “RIP” Not Microsoft’s
19. The Microsoft Entity Data Model An extended relational model with Entity-Relationship Model concepts Entity Types Strong type with Identity Inheritance Scalar/Complex properties EntitySets Hold instances of Entity Types Similar to relational tables Can have multiple Entitysets of the same EntityTypes Relationships ("Associations") Named relationships between Entities 0..1:*, 0..1:0..1, 1:1, 1:M, M:N Navigation may be exposed as NavigationProperties on EntityTypes AssociationSets Contains instances of associations May be queried directly EntityContainers Contains EntitySets, AssociationSets SalesPerson EmployeeID = 294272LoginID = adamTitle = "Dev Lead"VacationHours = 0… Manager 1 1 N Reports SalesPerson SalesPerson EmployeeID = 729742LoginID = peteTitle = "Developer"VacationHours = 0…ExpenseAccount = …CarLicenseNum = …… SalesPerson EmployeeID = 729742LoginID = peteTitle = "Developer"VacationHours = 0…ExpenseAccount = …CarLicenseNum = …… EmployeeID = 729742LoginID = peteTitle = "Developer"VacationHours = 0…ExpenseAccount = true…
20. EDM & Entity Framework? The Entity Framework (EF) is an Object Relational Modeling tool leveraging the EDM Focus on your domain, not how to persist! EDM is used to describe your model. Allows different rate of change between database and code! EF uses a storage model and mapping to enable this.
21. IEnumerable<T> LINQ to Entities Entity SQL Query Object Services EDM DataReader Entity SQL Conceptual Model Mapping Entity Data Provider DataReader SQL Storage Model ADO.NET Data Provider EF Model
22. Performance & Security? Connections to database vs. amount of data You can work with stored procedures You can work with views You can define how the ADO.NET Entity Framework loads your data to Eager Lazy (Explicit)
23.
24.
25. Entity Framework in .NET 4 Model First T4 Templates to control code generation Supporting DDD approach with POCO Persistence Ignorance Repository pattern Query Improvements Lazy Loading Disconnected API’s to enable N-tier
27. WCF Data Services Overview Framework from Microsoft that that facilitates the creation of RESTful data services via HTTP endpoints Shipped with .NET 3.5 SP1 Updates for 3.5 SP1 and .NET 4.0 Built on top of WCF4 Data representation in ATOM or JSON
28. WCF Data Services Overview Automates the exposure of data as RESTful resources Anything that implements IQueryable<T> and IUpdatable<T> Entity Framework 3rd party ORMs LINQ to SQL, custom data driven CLR classes Custom URI based querying
29. HTTP http://localhost:1234/MyData.svc/MyEntities(10) Open Data Protocol (OData) Hosting/HTTP Listener Data Services Runtime var q = from e in MyEntities where id = 10 select e; Data Access Layer Entity Framework Custom LINQ Provider SELECT * FROM MyEntity WHERE id = 10 Relational Database Other Sources
30.
31.
32. WCF Data Services in .NET 4 Query Projections Query results can be modified to include only a subset of properties by using the new $select query option. Custom Data Service Providers Can implement a set of new data service provider interfaces, you can use various types of data with a data service, even when the data model changes during execution. Streaming of Binary Resources This enables you to retrieve and save binary large object data independent of the entity to which it belongs.
36. Resources ADO.NET Team Blog http://blogs.msdn.com/adonet/default.aspx EF Design Blog blogs.msdn.com/efdesign Visual Studio Data Blog http://blogs.msdn.com/vsdata/ dnrTV! http://shrinkster.com/1734 http://shrinkster.com/1735
37. Resources ADO.NET team blog http://blogs.msdn.com/adonet WCF Data Services team blog http://blogs.msdn.com/astoriateam
Goals:To show a new way of serving up dateGet you thinking to learn more when you leave this presentation
Maintainabity, security, efficiency andscalability let a DBA decideto:Splitdata of oneentityintoseveraltablesPutting data forseveral types of entitiesintosametableSupply projectionsthatlooseentity concepts thatmight have been present in tablestructures
Talk about the separation between database developer and programmer.
Talk about the separation between database developer and programmer.
Typed Datasets – shippedObjectspaces ‘v1’ – never shippedObjectspaces ‘v2’ – never shippedMicrosoft Business Framework – never shippedWinFS – never shippedLinq to SQL – shipped, won’t be discontinuedLinq to Entities – shippedEntity Framework- shipped
Applications can work in terms of a more application-centric conceptual model, including types with inheritance, complex members, and relationships.Applications are freed from hard-coded dependencies on a particular data engine or storage schema.Mappings between the conceptual model and the storage-specific schema can change without changing the application code.Developers can work with a consistent application object model that can be mapped to various storage schemas, possibly implemented in different database management systems.Multiple conceptual models can be mapped to a single storage schema.Language-integrated query (LINQ) support provides compile-time syntax validation for queries against a conceptual model.
Explain the inner workings of the entity framework Three types of commands: LINQ to Entities against Object Services Materialization to Conceptual model classes or anonymous classes if projected Entity Sqlagaints Object Services Materialization if no projection + streamed data on row level Call model defines functions or specific Entity SQL functions. Entity Sql against Entity Client No materialization + streamed data on column levelExplain the path of commands…