TVF Example in Chapter 10

At least one reader has encountered a problem with the Table-Valued Function (TVF) example in Chapter 10 of Microsoft ADO.NET Entity Framework Step by Step when working with Visual Studio 2013. Before you begin this example, make absolutely certain that you have setup and configured SQL Server for use with the book. You can find the required instructions in these posts:

In addition, you must start the SQL Server Browser. Otherwise, the example will never work.

First, the good news—the example does in fact run. If you use the downloadable source code, rather than trying to type the example in by hand, you can see it function and work through the example using any technique you like (such as the debugger). However, as I pointed out in Entity Framework Examples – Visual Studio 2013 Update, this book really is designed to work best with Visual Studio 2012, so it’s not unexpected that you may encounter problems if you don’t follow the guidelines in the System Requirements section of the Introduction (page xxii).

The bad news really isn’t that bad. You may see an error, “Error 3027: No mapping specified for the following EntitySet/AssociationSet – ObtainClientsEntities” when you compile the example.  The example will still work, but the error message is disconcerting. Unfortunately, I haven’t been able to reproduce it on my system using Visual Studio 2012. You may be able to rid yourself of this error message by erasing the .suo files in the example file and doing a complete rebuild of the example.

In addition, when you open the Rewards2Model.edmx file in the XML editor, you may see “Error 11007: Entity type ‘ObtainClientsEntity’ is not mapped.” Again, I haven’t been able to reproduce this error. There is some discussion that you really must create the table before creating the example application in order to avoid this error. However, taking that step would reduce the usefulness of the technique. Again, the example works just fine even with this error in place.

What is need to know is whether these two errors are common and what I need to do to reproduce them. It may be that there is a quick fix that has so far eluded notice. In the meantime, it’s safe to ignore the two errors because the example does run, even when you’re working with Visual Studio 2013. Please contact me with your findings at


Entity Framework Examples – Visual Studio 2013 Update

Microsoft has a habit of making updates between versions of Visual Studio applications difficult. For example, the simple act of opening a solution (.SLN) file using a different version of Visual Studio than the one used to create it can be difficult or impossible. Most technology updates contain breaking changes that mean older code requires tweaks in order to continue working. Even the Visual Studio IDE interface changes, which means step-by-step instructions no longer work properly. Unfortunately, all of these sorts of changes have affected the examples in Microsoft ADO.NET Entity Framework Step by Step. This book is written to support:


  • Visual Studio 2012 Professional (or above)
  • Entity Framework 5.x

It doesn’t surprise me that Visual Studio 2013 developers are encountering problems with the book. Changes to the IDE mean that the step-by-step instructions won’t work as stated and there isn’t an easy method of fixing this problem short of rewriting the book. Likewise, changes to the Entity Framework mean that some assemblies such as System.Data.Entity don’t even exist any longer, so some book explanations won’t make sense.

However, it’s still possible to open the examples and see how they work. Instead of opening the .SLN file associated with an example, open the C# Project (.CSProj) file. For example, when looking at the example in Chapter 1, you open the SimpleEF.csproj file found in the \Microsoft Press\Entity Framework Development Step by Step\Chapter 01\SimpleEF\SimpleEF folder instead of the SimpleEF.sln file found in the \Microsoft Press\Entity Framework Development Step by Step\Chapter 01\SimpleEF folder when using Visual Studio 2013.

Much of the theoretical, usage, and general functionality information in the book (about half of the book) is still useful to the Visual Studio 2013 developer as well. So, there is still a lot of value to obtain by reading my book, but readers are right to point out that not every feature will work as written. Please accept my apologies in advance if you purchased the book and were disappointed with it. I did provide clear instructions about the products to use with the book in the book’s Introduction, but such information can be easy to miss.

As always, I try to provide every reader with a great reading experience. Should the publisher decide to update this book, you’ll learn about the update here when I start looking for beta readers. Please let me know about your other book-specific questions at


Finding the Source Code for Microsoft ADO.NET Entity Framework Step by Step

Sometimes a bit of information isn’t known by an author at the time of writing, so the book will contain placeholder text to remind everyone to add the information later. Normally, the process works great and the replacement is made without problem. I was recently informed of a problem in Microsoft ADO.NET Entity Framework Step by Step. It turns out that there is placeholder text in some places that reads, “Provide URL Here.” I added the placeholder because I didn’t know where the publisher would store the book’s source code at the time of writing. Of course, the placeholder is hardly helpful to anyone who really would like to find the book’s source.

If you encounter such a placeholder in this book, please go to the O’Reilly download site at or to obtain the files. I really do consider it important that you download the book’s source code and use it as you work through the text. This particular book has a lot of complex examples that will be tough to get right if you type them in by hand. A single typo can make the examples completely unusable, or at least cause damage to your sample database.

In addition to reading about potential problems and obtaining useful bits of additional information by reading my blog, make sure you also check the book’s errata page at (see my Errors in Writing post as well). This page provides you with succinct summaries of potential problems and the fixes I suggest for them. Always feel free to write me about my books as well at It’s important to me that you always have a great experience when using my books.


Database Creation Differences Amongst Language Versions

The issues that come with working with non-English language versions of Visual Studio are becoming more apparent as readers write to me about them. Here is the essential problem that you need to consider when reading this post. I strongly endorse use of the downloadable source when working with one of my books. Using the downloadable source means that you don’t have to worry about problems with internationalization or with typos for that matter. All you need to do is load the example into your copy of Visual Studio and follow along as you read the book.

However, many people learn by doing and that’s when problems come into play. If you recreate the examples from scratch, you could encounter problems that have nothing to do with your programming skills or your ability to follow directions. In this case, the problem isn’t the fault of the reader, but of Visual Studio. Databases are created differently by the Entity Framework designer when working with various language versions.

A German reader was kind enough to send me some screenshots of a particular issue that I don’t discuss in the book because I was unaware of it when I wrote it (and a lack of international beta readers kept me from learning about it until now). If you look at the Entity SQL example that begins in the “Creating a basic query using Entity SQL” section of Chapter 4 (page 86), you see that the code interacts with the Customers table. You create this table earlier in the book and it should appear as Customers in SQL Server Management Studio. However, it doesn’t appear under that name if you’re working with the German version of Visual Studio. The IDE appends the word Satz (set) to the table name as shown here (all screenshots are courtesy of my German reader):


Consequently, when you try to create the code shown on page 87, it doesn’t work. It would work if the table had the right name or if the code used the right name, but the two are out of sync. In order to make this example work, you must change the example code as shown here:


Of course, making the code change (circled in red) does solve the problem, but it’s not something the developer should have to deal with. In addition, consider how things will work if you’re interacting with a number of team members in different countries—all of whom are using their own language versions of Visual Studio. The resulting chaos must be impressive indeed.

The true source of the problem is the Entity Framework Designer. When you initially create your design, the name of the entity might be Customers, but the Properties window will automatically add Satz to the name for you as shown here:


To make the book examples work as they appear in the book, you need to ensure that the entity names match those in the book. In this case, all you need to do is remove the Satz part of the name.

Unfortunately, these sorts of problems will continue to crop up with various languages. I’d like to hear about them because knowing what could happen will help me write better books in the future and to provide updates to you here. I really appreciate all of the help my German reader provided in this case. Contact me with any other language-specific glitches you find at


DateTimePicker Control Data Type Mismatch Problem

A reader recently made me aware of a problem with the Get User Favorites example in Chapter 2 that could cause a lot of problems depending on which language you use when working with Visual Studio 2012. This issue does affect some of the examples in Microsoft ADO.NET Entity Framework Step by Step so it’s really important you know about it.

Look at the model on page 30 of the book (the “Creating the model” section of Chapter 2). The Birthday field is defined as type DateTime. When you finish creating the model, you right click the resulting entity and choose Generate Database from Model to create a database from it. The “Working with the mapping details” section of Chapter 1 (page 19) tells you how to use the Generate Database Wizard to create the database. The Birthday field in the database will appear as a datetime type when you complete the wizard, which is precisely what you should get.

At this point, you begin creating the example form to test the database (the “Creating the test application” section on page 36). The example uses a DateTimePicker control for the Birthday field by default. You don’t add it, the IDE adds it for you because it sees that Birthday is a datetime data type. The example will compile just fine and you’ll be able to start it up as normal.

However, there is a problem that occurs when working with certain languages when you start the “Running the basic query” section that starts on page 39. The DateTimePicker control appears to send a datetime2 data type back to SQL Server when you change the birthday information. You’ll receive an exception that says the data types don’t match, which they don’t. There are several fixes for this problem. For example, you could coerce the output of the DateTimePicker control to output a datetime data type instead of a datetime2 data type. However, the easiest fix is to simply change the data type of the Birthday field in the database from datetime to datetime2. After you make this change, the example will work as it should. You only need to make this change when you see the data type mismatch exception. I haven’t been able to verify as of yet which languages are affected and would love to hear from my international readers about the issue.

As far as the book is concerned, this problem is quite fixable using the manual edit (although, manually editing the database shouldn’t be something you should have to do). However, it does bring up the question of how teams working across international boundaries will interact with each other if they can’t depend on the controls acting in a particular way every time they’re used. This is a problem that you need to be aware of when working with larger, international, teams. Let me know if you have any questions or concerns about the book example at You’ll have to contact Microsoft about potential fixes to the DateTimePicker control since I have no control over it.


Extra File in Entity Framework Book Downloadable Source

At least one reader has noted that there is an extra file in the file which is part of the downloadable source for Microsoft ADO.NET Entity Framework Step by Step. The Rewards2 RowVersion.mdf file isn’t used by any of the examples in the book. This was a test file that I used for experimentation purposes and you can safely delete it or simply ignore it. You certainly don’t need to install it in SQL Server. I had actually forgotten about that file and uploaded it with the rest of the downloadable source. I’m sorry about any confusion that the extra file has caused. Please let me know if you have any questions about it at


Continuing Education

I don’t know if you’ve noticed, but I’m continually asking questions in my blog posts. In fact, you can find questions in a few of my books and more than a few readers have commented when I ask them questions as part of my correspondence with them. I often get the feeling that people think I should know everything simply because I write books of various sorts. In fact, I had to write a post not long ago entitled No, I Don’t Know Everything to address the issue. Experts become experts by asking questions and finding the answers. They remain experts by asking yet more questions and finding yet more answers. Often, these answers come from the strangest sources, which means that true experts look in every nook and cranny for answers that could easily elude someone else. Good authors snoop more than even the typical expert—yes, we’re just plain nosy. So, here I am today asking still more questions.

This year my continuing education has involved working with the latest version of the Entity Framework. The results of some of my efforts can be found in Microsoft ADO.NET Entity Framework Step by Step. You can also find some of my thoughts in the Entity Framework Development Step-by-Step category. I’ve been using some of my new found knowledge to build some applications for personal use. They may eventually appear as part of a book or on this blog (or I might simply choose to keep them to myself).

However, my main technical focus has been on browser-based application technology. I think the use of browser-based application technology will make it possible for the next revolution in computing to occur. It certainly makes it easier for a developer to create applications that run anywhere and on any device. You can find some of what I have learned in two new books HTML5 Programming with JavaScript for Dummies and CSS3 for Dummies. Of course, there are blog categories for these two books as well: HTML5 Programming with JavaScript for Dummies and Developing with CSS3 for Dummies. A current learning focus is on the SCAlable LAnguage (SCALA), which is a functional language (akin to F# and many other languages of the same type) based on Java.

Anyone who knows me very well realizes that my life doesn’t center on technology. I have a great number of other interests. When it comes to being outdoors, I’ve explored a number of new techniques this year as I planted some new trees. In fact, I’ll eventually share a technique I learned for removing small tree stumps. I needed a method for removing stumps of older fruit trees in order to plant new trees in the same location.

I’ve also shared a number of building projects with you, including the shelving in our larder and a special type of dolly you can use for moving chicken tractors safely. Self-sufficiency often involves building your own tools. In some cases, a suitable tool doesn’t exist, but more often the problem is one of cost. Buying a tool from the store or having someone else build it for you might be too expensive.

The point I’m trying to make is that life should be a continual learning process. There isn’t any way that you can learn everything there is to learn. Even the most active mind picks and chooses from the vast array of available learning materials. No matter what your interests might be, I encourage you to continue learning—to continue building your arsenal of knowledge. Let me know your thoughts on the learning process at


Designing with the Entity Framwork

A number of factors have contributed toward the evolution of the Entity Framework (a technology used to map database entities to objects used within .NET application programs). However, one of the major factors is the way in which developers work. Not all developers work in the same way and not every situation requires the same solution. With this in mind, Microsoft ADO.NET Entity Framework Step by Step helps you understand how the evolution of the Entity Framework has been affected by these factors. It points out how the alternatives provided by the Entity Framework make your job easier by increasing the flexibility of the development environment.

One of the more important evolutionary steps is the inclusion of three modeling techniques within the Entity Framework: Model First (where you create a database based on a model you define), Database First (where you generate a model based on an existing database), and Code First (where you generate a database based on the objects in an existing application without using a designer-based model). You can read about these three models and how they affect your application development in my recent article, “Choosing the Right Entity Framework Workflow.” The purpose of this article is to help you make the best choice in modeling technique for your next Entity Framework project. The article also points out the need to combine techniques at times to obtain a desired result and helps you understand some of the pros/cons of each approach. Of course, there is no wrong or right approach—simply the approach that works best for you.

The Entity Framework is a necessary technology when dealing with the complexities of a large scale development. Modeling tools make it possible to understand complex interactions with greater ease and to explain those interactions to others who might not have development experience. In addition, you use modeling tools to document how objects in an application relate to the tables and other features of a database. Knowledge like this is incredibly important when working in a team environment where team members must communicate well with each other or the project is doomed to failure. Most importantly for the developer, using a modeling technology like the Entity Framework greatly reduces the confusion that can occur when developer moves outside the comfort of a familiar development environment.

Of course, there is a lot more to be said about the Entity Framework and this article (and even my book) are really just a starting point. I always like to get the reader perspective about materials that I write. What are your experiences in using the Entity Framework? Let me know at


Finding the Errata for Microsoft ADO.NET Entity Framework Step by Step

I’ve written about the potential for errors in books before as part of my Errors in Writing post. One of the reasons I have created this blog is to help you through some of the worst errors that make it into my books (despite the best efforts of myself, other professionals, and the hard working beta readers). Now that Microsoft ADO.NET Entity Framework Step by Step has been released, a few readers have noted a couple of glitches.

One of the most noticeable errors appears on page 384. Look at Steps 6 and 9. The graphics after the two steps have been swapped. The image shown after step 6 should actually appear after step 9. Likewise, the image shown after step 9 should actually appear after step 6. Generally, graphic mix-ups like this don’t occur, but they do sometimes and they always prove confusing for the reader. It’s one of those situations where the mix-up escaped everyone’s notice during the proofreading process and I’m sorry about any confusion the error might have caused as you start working through the procedures in this chapter. You can see more errors and additional information for this book in the Entity Framework Development Step-by-Step category of this blog.

There are also a couple of other minor errors that have been found by readers and uploaded to the errata page for this book on the O’Reilly site. The table shows the location of the error and the resolution you should use when working through that error. Generally speaking, if you see an entry in the table, it probably affects all versions of the book, not just the single version in which the error was originally found.

You should also go to the general page for this book to gain access to other publisher-supported resources for it. For example, the general page contains links for the companion content for the book, as well as a means to register your book purchase with O’Reilly.

I always want you to have a great experience using my books. Errors tend to make that experience less than stellar, but mistakes do happen and the best I can do is to tell you how to correct them once they’re found. If you ever find an error in this, or any other of my books, please be sure to write me at Thank you for continuing to support my writing efforts. I greatly appreciate your help.


Considering the Increasing Need for Security

Many of the readers I work with have noted an increase in the amount of security information I provide in my books. For example, instead of being limited to a specific section of the book, books such as Microsoft ADO.NET Entity Framework Step by Step (the new name for Entity Framework Development Step by Step) and HTML5 Programming with JavaScript for Dummies provide security suggestions and solutions throughout the book. The fact of the matter is that this additional security information is necessary.

There are a number of factors that have changed the development environment and the way you design applications. The most significant of these factors is the whole Bring Your Own Device (BYOD) phenomenon. Users bring devices from home and simply expect them to work. They don’t want to hear that their favorite device, no matter how obscure or unpopular, won’t work with your application. Because these devices aren’t under the IT department’s control, are completely unsecured, and could be loaded with all sorts of nasty software, you have to assume that your application is always under attack.

Years of trying to convince users to adopt safer computing practices has also convinced me that users are completely unconcerned about security, even when a lack of security damages data. All the user knows is that the application is supposed to work whenever called upon to do so. It’s someone else’s responsibility to ensure that application data remains safe and that the application continues to function no matter how poorly treated by the user (through ignorance or irresponsible behavior is beside the point). Because of this revelation of human behavior, it has become more important to include additional security discussions in my book. If the developers and administrators are going to be held responsible for the user’s actions, at least I can try to arm them with good information.

The decentralized nature of the security information is also a change. Yes, many of my books will still include a specific security chapter. However, after getting a lot of input from readers, it has become apparent that most readers aren’t looking in the security-specific chapter for information. It’s easier and better if much of the security information appears with the programming or administration techniques that the reader is reviewing at any given time. As a consequence, some of my books will contain a great deal of security information but won’t even have a chapter devoted to security issues.

I’m constantly looking for new ways to make your reading experience better. Of course, that means getting as much input as I can from you and also discussing these issues on my blog. If you have any ideas on ways that I can better present security issues to you, let me know at