Category Archives: Book

Modified Description of Adding Inheritance into T4 Template from Chapter 18

This is in reference to Programming Entity Framework 2nd Edition

When I originally wrote the directions for modifying the T4 template in Chapter 18 (Using POCOs and Self-Tracking Entities in WCF Services), I was working with the “almost” RTM version of the Microsoft’s POCO T4 template. Since my modified template continued to work after RTM, I never thought to revisit that text and discovered yesterday that it doesn’t follow the current version of the template and therefore the instrux are unclear & confusing.

My discovery did not come from a reader but was made when I was working with a client and wanted to make that same modification in her template.

When I originally wrote that description I was borrowing some code from the EntityObject template that had a dependency on a variable called ModelNamespace. But in the newer version of the POCO template, that variable is no longer used.

Here are the modified paragraphs and links to the templates that you can download from the book’s website.

read more at :

Descriptions of 1st and 2nd Edition of Programming Entity Framework

I’m waiting for the O’Reilly site, Amazon and elsewhere to update the descriptions of the two different editions of my book. Since not everyone is lucky enough to move to VS2010 and EF4, both editions will be on the market. Right now they both have the same description online which is wrong. I don’t want anyone to get the wrong edition and then be misled.

Here are rough drafts of what the updated descriptions will look like:

1st edition (for EFv1 and VS2008/.NET 3.5SP1)

Programming Entity Framework is a thorough introduction to Microsoft’s core framework for modeling and interacting with data in .NET applications. This highly-acclaimed book not only gives experienced developers a hands-on tour of the Entity Framework in Visual Studio 2008 and .NET 3.5, explaining its use in a variety of applications, it also provides a deep understanding of its architecture and APIs. While many of the lessons from this first edition will continue to be valuable as you move to .NET 4.0, the second edition (link???) of Programming Entity Framework targets Visual Studio 2010 and .NET 4.0 where there have been many advancements and additions to the framework. From the Entity Data Model (EDM) and Object Services to EntityClient and the Metadata Workspace, this book covers it all.


2nd Edition (for EF4 and VS2010/.NET 4)

Programming Entity Framework, 2nd Edition is a thorough introduction to Microsoft’s core framework for modeling and interacting with data in .NET applications. On the heels of the highly-acclaimed first edition, this book not only gives experienced developers a hands-on tour of the Entity Framework in Visual Studio 2010 and .NET 4.0, explaining its use in a variety of applications, it also provides a deep understanding of its architecture and APIs. You’ll find hundreds of examples and numerous sample applications that take advantage of the new features in Entity Framework 4.0.  Whether you are building Rapid Application Development software or highly architected applications that are testable and provide a separation of concerns,  you’ll find hundreds of examples and numerous sample applications to help you achieve your goals. The book is filled with insight into the inner workings of the Entity Framework to help you become an Entity Framework expert. From the Entity Data Model (EDM) and Object Services, from WPF to ASP.NET MVC, from drag and drop to domain-centric applications, this book covers it all.

Both books are roughly the same length (app 800 page).

The *list* price for both editions is 54.99.

You can pre-order the 2nd edition at OReilly for $39.99 ( and on Amazon for $37.79 (

O’Reilly tells me we’re on track for August 15th release. Amazon says August 26th but that’s probably when they expect to have the books in their warehouse to be able to ship.

Programming Entity Framework, 2nd Edition (EF4) Table of Contents

We are closing in on finalizing the 2nd edition of Programming Entity Framework! Although the rough draft chapters are already available through Safari’s Rough Cuts program (here: I have been editing and reshaping the content since those chapters were published. You can get the final print edition (August 15th or perhaps a bit earlier) at O’Reilly or pre-order it here on (here) (and elsewhere of course!)

I believe that the book will end up being about the same length (app. 800 pages) as the first edition.

Here is the final chapter list:

Chapter 1, “Introducing the ADO.NET Entity Framework”

Chapter 2, “Exploring the Entity Data Model”

Chapter 3, “Querying Entity Data Models”

Chapter 4, “Exploring LINQ to Entities in Greater Depth”

Chapter 5, “Exploring Entity SQL in Greater Depth”

Chapter 6, “Modifying Entities and Saving Changes”

Chapter 7, “Using Stored Procedures with the EDM”

Chapter 8, “Implementing a More Real-World Model”

Chapter 9, “Data Binding with Windows Forms and WPF Applications”

Chapter 10, “Working with Object Services”

Chapter 11, “Customizing Entities”

Chapter 12, “Data Binding with RAD ASP.NET Applications”

Chapter 13, “Creating and Using POCO Entities”

Chapter 14, “Customizing Entity Data Models Using the EDM Designer”

Chapter 15: “Defining EDM Mappings That Are Not Supported by the Designer”

Chapter 16, “Working with Stored Procedures Without Function Mapping or Function Imports*

Chapter 17, “Using EntityObjects in WCF Services”

Chapter 18, “Using POCOs and Self-Tracking Entities in WCF Services”

Chapter 19, “Working with Relationships and Associations”

Chapter 20, “Managing Connections, Transactions, Performance, and More for Real-World Applications”

Chapter 21, “Manipulating Entities with ObjectStateManager and MetadataWorkspace”

Chapter 22, “Handling Exceptions”

Chapter 23, “Planning for Concurrency Problems”

Chapter 24, “Building Persistent Ignorant, Testable Applications”

Chapter 25, “Domain Centric Modeling ”

Chapter 26, “Using Entities in n-Tier Client-Side Applications”

Chapter 27, “Building n-Tier Web Applications”

Appendix A, “Entity Framework Assemblies and Namespaces”

Appendix B, “Data-Binding with Complex Types”

Appendix C, “Additional Details about Entity Data Model Metadata”

* Need to come up with a better title for Ch 16. It’s all the stuff you can do with sprocs & (views too) that aren’t supported by the designer.

News about Programming Entity Framework 2nd Edition

Programming Entity Framework 2nd Edition (based on the RTM of VS2010/.NET 4.0) is currently available on Safari Rough Cuts at At this point most of the chapters are there. You’ll find 2-23. Note that chapter 4 will be broken into 4 and 5 in the final edition. I changed the chapter numbering after chapter 16 to accommodate this which is why there is no chapter 17. Chapters 24 is about n-Tier CLient applications using an WPF example and chapter 25 is about n-Tier web apps with ASP.NET MVC and ASP.NET WebForms examples both using the repository built in Chapter 22. Chapter 1 will be introductory as it was in the first edition and Chapter 26 will wrap up some loose ends.

The book is now going through copy editing and technical editing so if you read the rough cuts and find a comma missing, don’t worry about it. If you happen to find something really wrong…a coding boo-boo or a misused term (I’m famous for switching inherits and implements) leave a note in the online feedback form on O’Reilly’s site so we can be sure to correct it before the final cut.

This is a complete rewrite of the book and includes not only the new features of Entity Framework, but chapters on unit testing, building repositories and even using Entity Framework in ASP.NET MVC applications. I’ve been working extra hard to be sure the book is current, not just a copy of the first edition.

We’re hoping to have the book in print by mid-July.

You can subscribe to the Rough Cuts, pre-order the final edition on O’Reilly or on Amazon. There will also be a variety of digital versions of the final book

Rough Cuts version of Programming Entity Framework 2nd Edition: Ch 2-22

rc_lrgUpdate August 14, 2010: The Rough Cuts program is over and the book is now out in Digital Format. You can purchase the digital version directly from OReilly at The print version should be shipping by August 20th. You can also purchase that through O’Reilly, Amazon or elsewhere.

In December, the first 5 chapters of the rough draft of Programming Entity Framework 2nd Edition (for EF4 & VS2010) were published to Safari Rough Cuts. There are now 20 chapters online there. There is no Chapter 1 yet and Chapter 4 is going to be split into 4 and 5. You’ll find that to make up for this split, there is no chapter 17 since 5 will become 6, 6 becomes 7, etc. Beginning with Chapter 18, the numbering is correct.

Just remember this is the *rough draft*. I have a number of amazing people providing feedback that will get incorporated and it still has to go through the copy edit phase as well. But even as a rough draft, it should be pretty good. 😉

Here is the url:

Note: the day after I posted this, Safari accidentally sent an email to Safari subscribers saying that the book is now in print. That was what we call a SNAFU. Not in print yet. Still a few more months.

What? I’m supposed to memorize it all?

It’s always funny to google for a solution to a problem and find your own blog post pop up with the answer.

I had to use an Entity SQL JOIN query today and I just went back to Chapter 5 to get a reminder of how to construct them. It’s not the first time I’ve taken advantage of what is currently my own personal resource.

What’s in a name?

This week I had to make a very difficult decision. It will make you laugh, but really, it was hard.

I had to decide if my book will say “Julie Lerman” or “Julia Lerman”.

After a LOT of deliberation, I decided to go with my grown up name: Julia Lerman. Which means that any searching on Amazon or whereever for “that book by Julie Lerman” won’t find it.

Writing Style: Me, Myself and I?

In my blog, I write as though I am just talking and the words me, myself and I appear quite a lot.

When writing technical articles, my editors constantly have to battle the “me myself and I” becuase the article is not supposed to be a story about me. Though I really do like to share those “man, this thing was killing me until I figured out x y and z” type of anecdotal lessons.

As I am writing my book, I have been extremely careful to make the book be about YOU, the reader. Even though I desparatley want to hold your hand and lead the way, I try to be consistent with YOU and even avoid WE as in “and now we’re going to do this”. It takes a lot of thought to figure out how to do this without being completely impersonal because that would just not be me.

Occasionally I have written essays for CoDe Magazine’s MVP Corner and I have an upcoming “End Bracket” essay in MSDN Magazine. These essays are where I get to write about me, myself and I as much as I want. Yay.

I just happened to come across a comment on a recent MVP Corner essay called Meeting Bill Gates. The comment said “Because it’s natural, I had a feeling like Julia Lerman talks face to face with me. Nice”

I just love that comment because this is the way I truly love to write.

Writing a book means – just like they all said…

Yep… no life.

Except for a few hours out to ski in the woods on Tuesday, I have literally been working from after breakfast to bedtime every day. I have basically been on this new schedule for a few months now and it is really unusual for me to be so focused.

Everyone warned me it would be like this.

It gets to the point where you just can’t invent time and don’t know what else to do but keep working until you just can’t any more. One thing I won’t do (and am not physically capable of doing) is cut back on my sleep.

I am definitely impressed that I can focus this well and be so driven. I just wish the pages would churn out more quickly.

When Michele Leroux Bustamante was writing Learning WCF, she told me that she felt she learned WCF at a depth which she never would have achieved if it hadn’t been for the “exercise” of writing the book. I totally understand this now. Before I started, there were things that I knew well about Entity Framework, things that I had heard of but hadn’t played with yet, things that I kinda knew but not really and obviously lots of things that I had no clue at all about.

So the first item in that list is easy to write about. Everything else is belaboured as I cannot bear to write a sentence unless I’m 150% sure of its accuracy.

I have had (rare) days where I wrote 20+ pages. On the other hand there have also been days (thankfully these are also rare) on which, if it weren’t for screen shots, I managed to produce only 4 pages over the course of 12  hours. I have spent so much time turning over every stone, every pebble and every grain of sand in between.

It is definitely an amazing process.

The strangest and most unexpected thing is that I have actually lost weight because I’m not lingering in the kitchen or running upstairs for snacks. Or for that matter going to the store. Rich is away for a few days and the fridge is running low. I just eat what I can find and get back to work. If nothing else, I can always be grateful for losing a few pounds. 😉 Good thing I started out with plenty of extra.

And like they say about the Army, it’s not a job (at least not a paying one), it’s an adventure.

Writing a book means: Learning the word “NO”

As a book-writing newbie, I have had to learn to say “no” when I’m used to always saying “yes”. For example, I just turned down an invitation to speak at a conference in India. I’ve never been to India. I hope I’ll get invited again.

But you know it’s serious when I had to say “no” to watching the first NEW episode in forever of Two and a Half Men last night. It pained me to hear Rich laughing his butt off while I stayed in front of my computer and tried to keep focused.

It’s gotten to the point that I was grumbling about having to go to a Dr. appointment on Monday. But I figured, heck, if I die, I can’t work anyway, so I might as well go and make sure I’m okay. Luckily it wasn’t a doctor who work in the mental health field. Surely they would have locked me up immediately!

Then of course there’s the skiing and other forms of exercise that I’m not getting. Thankfully (for me, not for the Mad River Glen’s finances) the snow has been dreadful lately.

My saving grace was that the power went out yesterday for an hour. SO I went outside and took a “brisk walk” (is that a sign of age? Not even a run!).

I was thrilled this evening when Rich presented me with an altered part to an old bike trainer that I was hoping to use at least to get some spinning in. The trainer didn’t fit my bike. So Rich altered the part and now it fits. Yay. Of course, I’m not on it, I’m working (well, blogging only for a momentary diversion).

It just occurred to me that this blog post sounds like an Andy Rooney commentary. Egad! Well back to work. Tick tick tick.