Errata

Programming Entity Framework: DbContext

Errata for Programming Entity Framework: DbContext

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page 33
before last paragraph (note)

I tested with lazyloading set to false like this:

context.Configuration.LazyLoadingEnabled = false;
TestLazyLoading();

yet, the data is still loaded, contrary to the note

Paul Pacurar  Feb 25, 2014 
Printed Page 34
1st paragraph

In the second sentence of the page, there's a typo: "Let's assume we want to run though"; it should be "through".

Rutger  Apr 22, 2016 
Printed, Page 104
2nd method of code on page

The line

values[originalValue.Key] = originalValue.Value;

is currently subject to a bug in Entity Framework. See here:

Entity Framework Set POCO OriginalValue to NULL
http://connect.microsoft.com/VisualStudio/feedback/details/751465/entity-framework-set-poco-originalvalue-to-null

Note from the Author or Editor:
Rowan, seeing these reports from EF4.3. was it fixed in EF5 or EF6?

Peter2060  Jun 30, 2012 
PDF Page 157
1st paragraph after the sidebar/call-out

Skipping the sidebar in the box at the top of th page, the second sentence in the first paragraph reads:

MaxLengthAttribute is one of a group of attributes that inherit from a class called System.Data.Annotations.ValidationAttribute.

I believe it should read:

MaxLengthAttribute is one of a group of attributes that inherit from a class called System.ComponentModel.DataAnnotations.ValidationAttribute.

Jim Kay  Feb 22, 2015 
PDF Page 160
3rd paragraph, it starts with: "You do this by applying..."

The paragraph reads:

You do this by applying the Metadata attribute to the Person class:
[MetadataType(typeof(Person_Metadata))]
public partial class Person

What is not made clear is that this MetadataType attribute must be applied to ANOTHER "public partial class Person {}", NOT the partial class generated by Visual Studio (VS). The partial class generated by VS has a note at the top of the (in this case) person.cs file telling you manual changes can be overwritten. And they will be overwritten if changes are made to the associated database table's design and the EF model is updated from the database.

My point is that the author obviously knows this. Seasoned developers will know this, too. But a developer new to EF or to Visual Studio may get tripped up on this - i.e., you need to make ANOTHER partial class. Clarifying this will make us freshmen get up to speed quicker on things that may be obvious to the seasoned developer.

Thus, it should be made clear that you can make multiple partial classes (in this case a "Person" partial class) and that you have to make a partial class that is not overwritten by a code generator. THEN add the attribute to that unaffected partial class.

Jim Kay  Feb 22, 2015 
PDF Page 163
the regular expression after 2nd paragraph

Origin: [RegularExpression(@"^[a-zA-Z''-'\s]{1,40}$")]
Suggestion: [RegularExpression(@"^[a-zA-Z-'\s]{1,40}$")]

The '' in this RegulaExpression makes no sense.

leecd  Nov 08, 2015