Persistence Ignorant Architecture with Entity Framework ORM.

I finished the screencast and have uploaded it to YouTube here. I also have attached the source code to this blog post, but I wanted to comment on a few post-video changes I have made.

providerConnectionString = String.Empty;

if (String.IsNullOrWhiteSpace(providerConnectionString)) {
    throw new System.NotImplementedException(Properties.Resources.ConnectionStringNotSet);
}

I removed App.config from the project (which was never needed). You will need to set the connection string yourself, and I added the code to throw an exception with a reminder in case you forget. You should be able to use the Create Database from Model feature in the Entity Designer, but I was having troubles in the screencast so I created the tables manually.

Screencast Demo Code
Visual Studio 2010
Download PI-Entity-Demo.zip

3 Comments

  1. Brian Stensrud

    HI again — just ran the executable from the Debug folder — almost instantaneous — I’m going to assume that the slowness is all caused by the VS IDE and accompanying design time ‘baggage’
    — ?? sound right to you ??

    thanks again
    b

    1. David Anderson (Post author)

      The slowness you are experiencing is likely from network latency or resource issues. There isn’t anything special about the code, it’s just normal inheritance/encapsulation.

  2. Brian Stensrud

    Hey David,

    just went through your tutorial — found it to be excellent .

    My question pertains to the loading of data — still using the console app to bring back the first record ( although I updated all of the code to use my own db ) and it takes about 5 seconds just to retrieve the 1st record ).

    Any thoughts on why this architecture ( if it is the architecture ) is causing data retrieval to be this slow?

    many t.i.a.
    b
    🙂

Leave a Comment