Tips and Tricks

Hopefully if you're reading this you've noticed that I've started a series of Tips recently.

The tips will mostly apply to Entity Framework or Data Services.

Seeing as I expect to have a lots of tips, it probably makes sense to have some sort of index.

That is what this is post is, as I add a new tip I will add it to this page too.

If you have any suggested topics for tips please let me know by leaving a comment or emailing me directly at Microsoft (Alexj is my alias at Microsoft, and emails at Microsoft are in the form alias@microsoft.com)

Without further ado here are what I have so far:

Tip 55 - How to extend an IQueryable by wrapping it

Tip 54 - How to improve performance using Statement Expressions

Tip 53 - How to debug EF POCO mapping issues

Tip 52 - How to re-use Types with the Data Services client

Tip 51 - How to load EF metadata from arbitrary streams

Tip 50 - How to query a Data Service using JQuery

Tip 49 – How to find your Data Service bug

Tip 48 - How to host a Data Service in WCF

Tip 47 – How fix-up can make it hard to change relationships

Tip 46 - How to exclude a property using Code-Only

Tip 45 - How to swap EF metadata at runtime

Tip 44 – How to navigate an OData compliant service

Tip 43 – How to authenticate against a Data Service

Tip 42 – How to create a dynamic model using Code-Only

Tip 41 - How to execute T-SQL directly against the database

Tip 40 - How to materialize presentation models via L2E

Tip 39 - How to set overlapping Relationships - EF 4.0 only

Tip 38 - How to use Code Only with Astoria

Tip 37 - How to do a Conditional Include

Tip 36 – How to Construct by Query

Tip 35 – How to write OfTypeOnly<TEntity>()

Tip 34 – How to work with Updatable Views

Tip 33 – How cascade delete really works in EF

Tip 32 – How to create a database from SSDL – EF 4 only

Tip 31 – How to compose L2O and L2E queries

Tip 30 - How to use a custom database function

Tip 29 – How to avoid LazyLoad or Load() reader issues

Tip 28 - How to implement an Eager Loading Strategy

Tip 27 – How to Implement BeforeSave Validation

Tip 26 – How to avoid database queries using Stub Entities

Tip 25 – How to get Entities by key the easy way

Tip 24 – How to get the ObjectContext from an Entity

Tip 23 – How to fake Enums in EF 4

Tip 22 - How to make Include really Include

Tip 21 – How to use the Single() operator – EF 4.0 only

Tip 20 – How to deal with Fixed Length Keys

Tip 19 – How to use Optimistic Concurrency with the Entity Framework

Tip 18 – How to decide on a lifetime for your ObjectContext

Tip 17 – How to do one step updates with AttachAsModified(..)

Tip 16 – How to mimic .NET 4.0’s ObjectSet<T> today

Tip 15 - How to avoid loading unnecessary Properties

Tip 14 - How to cache Entity Framework Reference Data

Tip 13 - How to Attach an Entity the easy way

Tip 12 - How to choose an Inheritance Strategy

Tip 11 - How to avoid Relationship Span

Tip 10 - How to understand Entity Framework jargon

Tip 9 - How to delete an object without retrieving it

Tip 8 - How to write 'WHERE IN' style queries using LINQ to Entities

Tip 7 - How to fake Foreign Key Properties in .NET 3.5 SP1

Tip 6 - How and when to use eager loading

Tip 5 - How to restrict the types returned from an EF Query

Tip 4 - Conceptual Schema Definition Language Rules

Tip 3 - How to get started with T4

Tip 2 - Entity Framework Books

Tip 1 - How to sort Relationships in the Entity Framework

Enjoy.