Learn how to build real world nTier applications with the new Entity Framework and related services introduced in .NET 3.5 SP1. 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. Lots of code!
5. nTier Architecture Overview Model to create flexible reusable applications Only need to modify or add layers instead of rewriting entire applications over
6. 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"
12. 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 Why use ORM? Productivity Retain database independence ObjectsClassesEntities
13. Object Relational Mapping There are many ORMs for .NET developers already in existence. E.g. LLBLGen Pro http://www.llblgen.com/ Nhibernate http://www.hibernate.org/343.html EntitySpaces http://www.entityspaces.net/Portal/Default.aspx
14. 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…
15. 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. Pain Points in v3.5 SP1 Pluralization/ Singularization Foreign Keys Model First Lazy Loading Additional LINQ Operators L2S Features & Patterns SQL Gen Improvements
22. Entity Framework in .NET 4 Improvements: 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
24. Data Services Overview Extends Windows Communication Foundation Functionality CRUD access to data over RESTful web services Built-in URI-based query syntax Client-side libraries for .NET and AJAX clients
25. Data Services HTTP Open Data Protocol Hosting/HTTP Listener Data Services Runtime IQueryable/IEnumerable [+ IUpdatable] Data Access Layer Entity Framework Custom LINQ Provider Relational database Other sources
26.
27.
28.
29. "Traditional" Applications Web applications Data services client can be used in ASP.NET ASP.NET data source control for accessing remote services Desktop applications Fully-featured .NET client library Same API in desktop and Silverlight environments
30. What’s New in .NET 4 Data Binding New DataServiceCollection class provides simplified binding of data service data to (WPF) controls. Includes auto updating. Counting Entities in an Set $count - total number of resources returned by a URI $inlinecount - total resource count together with the resource data Server-driven Paging Service can be configured to return requested resources as a set of paged responses
31. What’s New 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.
35. Before You Begin… What I Have Learned So Far About The Entity Framework and ADO.NET Data Services http://dotnettips.com/2008/09/30/WhatIHaveLearnedSoFarAboutTheEntityFrameworkAndADONETDataServices.aspx *Part 2 coming out soon! Using Microsoft ADO.NET Data Services http://msdn.microsoft.com/en-us/library/cc907912.aspx
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 Dan Simmons Blog http://blogs.msdn.com/dsimmons/ MSDN Code Gallery http://shrinkster.com/1733 WCF Data Services Learning Guide: http://msdn.microsoft.com/en-us/data/bb931106.aspx WCF Data Services Team Blog http://blogs.msdn.com/astoriateam/default.aspx
Goals:To show a new way of serving up dateGet you thinking to learn more when you leave this presentation
How do you or have you designed your applications??? Be truthful!!N-tier application architecture provides a model for developers to create a flexible and reusable application. By breaking up an application into tiers, developers only have to modify or add a specific layer, rather than have to rewrite the entire application over, if they decide to change technologies or scale up. In the term "N-tier," "N" implies any number -- like 2-tier, or 4-tier; basically, any number of distinct tiers used in your architecture. Application architectures are part of Layer 7 of the OSI model.
Talk about the separation between database developer and programmer.
Talk about the separation between database developer and programmer.
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.