Monday, February 27, 2012

Create Entity Framework Data Context for LINQPad 4

In what I hope to be my last prerequisite post for Entity Framework on LINQPad, I will create a Data Context for my Entity Model Assembly.

I like to use LINQPad as a snippet editor because of its cool Dump() extension method. This platform makes it easy to play What If with a new technology.

For the purpose of these steps, I’m going to pretend you are using the assembly we created in [last post]. So here are the steps:

  1. Open LINQPad 4
  2. Click on Add Connection
  3. In the Choose Data Context window, choose Entity Framework.
    Choose Data Context
  4. In the LINQPad Connection window, Browse for your EF Model Assembly
  5. In the Choose Custom Type:
    • In Custom Type Name you should see PubsModel.pubsEntities
    • In Entity Data Model, choose From Same Assembly, PubsModel should be in the list below
    • Click OK
    Choose Custom Type
  6. Accept the remaining defaults by clicking OK.LINQPad Connection

No comments: