Daily Archives: December 20, 2007

Some great Entity Framework Guidance about Performance in client applications

I have spent a lot of time thinking about Entity Framework in web applications and in SOA and worrying about performance, serialization and concurrency.

But I haven’t spent a lot of time worrying about these things with respect to client apps (winforms and WPF).

In a great thread started by Nick in the forums where he was asking about keeping huge lists around in an application without having to hit the db over and over, both Danny Simmons and I assumed he was talking about web apps and started down the whole serialization/caching path.

But it turned out that Nick was worried about a WPF app which changes everything when you are thinking about performance.

In the end, Danny gave this great guidance (with my highlight):

“The context is safe to keep around as long as you are careful to make sure that it is always used only on a single thread (put it into thread local storage and have one copy for each thread if you need multiple threads).  The connection will open and close automatically as needed so you don’t need to worry about holding a connection open.  Long-running contexts are the expected pattern for rich client appsjust not the right plan for asp.net scenarios and the like where you want the server to be as stateless as possible.”

What’s with all the breaking stuff today?

Yesterday was the first break – I broke a promise to myself that I was going to take a few hours out to go skiing. I never did.

Right now we have the most phenomenal snow in Vermont…highly unusual for December (it’s still Fall, y’know) and everyone who loves snow wants to enjoy it while they can just in case.

So today I was determined not to break my promise. I didn’t leave until 1 hour later than I wanted, but I left. I got to Mad River, put on my boots and defogged my goggles with the great defogger cloth I bought instead of buying new goggles last year. But I noticed there was a 1 inch crack in my goggles. Oh well. I put them on anyway, went outside, grabbed my skis and walked over to the single chair where I put them on. First the right, then the left. Something looked funny on the left. My binding was BROKEN! There’s a big plastic piece that pulls the cable tight around the boot and it was cracked. But I could still clamp down and it seemed solid.

Just in case, I went to the ski shop and they said that it would be way too dangerous to ski on them. Arrgh. We are talking PERFECT PERFECT packed powder conditions, 30 degrees and no wind. And I couldn ski. Rather than renting skis and skiing anyway, I drove down the mountain in to Waitsfield and dropped off my skis at a local ski place to get the bindings either fixed or replaced overnight.

Then I drove home and figured I’d go ski in my woods instead.

I took out my brand new back country boots that I’ve only worn 3 times so far. They are new fangled hightech boots and the zip up (similar to cross-country boots now). The zipper pull broke off in my hand.

I managed to zip it up anyway and I finally got out to do one loop in the woods with no more breaks and got back to the house before dark. The snow was so perfect, it was worth all the effort.

But geeze loueeze – that was starting to push it!