Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dev303 Leap In Productivity With Linq And Entity Framework 4

2,589 views

Published on

For TechEd ME attendees:
DEV 303, wednesday 11am Dubai C

One might ask, how can one be even more productive than with a DataGrid bounded with a DataSource? Is it even possible?

It sure is possible! To me, being productive doesn’t just mean starting fast, but keeping a sustainable pace as things get more complex. This is what true productivity is all about.

We’ll look at the evolution of design from Smart UI type of architecture (Rapid Application Development), 3 tier (Transaction Scripts) to Domain Driven design with rich domain models with behaviors. I will introduce the first few examples using Linq to SQL, and will take it to the finish line using the upcoming Entity Framework 4 and its POCO support.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Dev303 Leap In Productivity With Linq And Entity Framework 4

  1. 1. Dev303: Leap Ahead in Productivity with LINQ & Entity Framework<br />Ronald Widha @RonaldWidhaTeam Lead<br />Infusion Development<br />
  2. 2. Required Slide<br />Complete an evaluation on CommNet and enter to win an HTC HD2!<br />
  3. 3. Agenda<br />Pattern #1: Smart Client<br />Pattern #2: 3 Tier Architecture<br />Domain Driven Design<br />Pattern #3: Domain Modelling<br />Entity Data Model<br />Entity Framework 4<br />Entity Framework 4 cool features (POCO, code only)<br />
  4. 4. Presentation Tier<br />Data<br />Smart Client<br />
  5. 5. Presentation Tier<br />Business <br />Data<br />3 Tier Architecture<br />
  6. 6. Demo: RAD and 3 Tier<br />
  7. 7. Domain Driven Design<br />“an approach to developing software for complex needs by deeply connecting the implementation to an evolving model of the core business concepts.”<br />
  8. 8. Domain Driven Design<br />Tackling complexity<br />How:<br />Talk to the business!<br />Focus on the core business domain <br />Design system based on a model<br />
  9. 9. The concept<br />Entity & Value Objects<br />Aggregate Roots<br />Repositories<br />Value Objects<br />Value Objects<br />Repository<br />Aggregate Root<br />Entity<br />Entity<br />Value Objects<br />
  10. 10. Keep it in sync with reality<br />Business rules change: REFACTOR!<br />Names change: REFACTOR!<br />
  11. 11. Presentation Tier<br />Business <br />Data<br />Domain Models<br />
  12. 12. Linq to Sql<br />Isn’t flexible enough for domain modelling<br />1-1 table mapping<br />Table per Hierarchy<br />No provider model<br />Awesome for data access<br />
  13. 13. Entity Data Model<br />An abstract conceptual model of data<br />Based on Entity Relationship Model by Dr. Peter Chen (1976)<br />Entities and Relationships<br />Entity types<br />Association types<br />Navigation properties<br />Sounds familiar??<br />
  14. 14. The Entity Framework 4<br />The next layer up in the ADO.Net stack<br />First product to implement EDM<br />Entity Data Model design tools<br />Strongly typed LINQ access<br />Declarative mapping to the database<br />The next version to Entity Framework 1 from .Net 3.5<br />Available in .Net 4.0<br />
  15. 15. Demo: Domain Driven approach using Entity Framework<br />
  16. 16. Full control<br />Just basic POCO: Plain Old CLR Objects<br />Persistence Ignorance<br />Turn off code generation from EDMX<br />
  17. 17. Demo: Domain Driven approach using Entity Framework POCO<br />
  18. 18. POCO and Other EF Features<br />Different ways of mapping: Table per class, Table per type, Table per hierarchy<br />Mapping with stored procedures<br />Explicit Loading<br />ObjectContext.LoadProperty(someObject, x => x.property)<br />Lazy Loading<br />Property as virtual<br />Uses proxy instance at runtime<br />
  19. 19. Code-only design<br />No model<br />Metadata is inferred from classes<br />Convention by Default<br />Configuration<br />Tweak configuration<br />Create database at runtime<br />
  20. 20. Last Notes<br />Don’t take the demo as best practice<br />There are a lot more to Domain Driven Design that what’s shown here<br />There are a lot more we can do to improve the demo code (Unit of work!)<br />EF4 is perfect to enable Domain Driven approach<br />
  21. 21. question & answer<br />
  22. 22. Required Slide<br />Speakers, <br />TechEd 2010 is not producing <br />a DVD. Please announce that <br />attendees can access session <br />recordings at TechEd Online. <br />www.microsoft.com/teched<br />Sessions On-Demand & Community<br />www.microsoft.com/learning<br />Microsoft Certification & Training Resources<br />http://microsoft.com/technet<br />Resources for IT Professionals<br />Twitter @RonaldWidha<br />http://blogs.msdn.com/adonet/<br />Resources for Developers<br />Resources<br />

×