The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Corrected".
The following errata were submitted by our customers and approved as valid errors by the author or editor.
| Version |
Location |
Description |
Submitted By |
Corrected |
| Other Digital Version |
x
Figure 9-6 |
On topic 9.3. Object Materialization it is said that EntityClient retrieves the database result into an EntityDataReader and then it passes it to the Object Services.
On figure 9-6 (The EntityClient providing the command execution functions for an ObjectQuery)
This figure is showing the result from the database going straight from the DataBase provider to the Object Services skipping the EntityClient.
Isn't the result supposed to pass by the EntityClient first before reaching the Object Services?
Note from the Author or Editor: Not sure at what stage in the game this image changed. Too late for 2nd printing. Get a new image from me when we go to next printing
|
Eduardo Coelho |
|
| Printed |
Page 1
2nd paragraph |
The sentence that reads:
"...as part of Visual Studio Service Pack 1 and .NET Service Pack 1,...
Should read:
...as part of Visual Studio 2008 Service Pack 1 and .NET Service Pack 1,...
Since it is that specific version of Visual Studio that is supported.
Note from the Author or Editor: as part of Visual Studio 2008 Service Pack 1 and .NET 3.5 Service Pack 1,...
|
Javier Estrada |
Sep 2009 |
| Safari Books Online |
21.3
Last sample in the section |
Not so much an error, but would be very useful if the following could be included above the sample for your ListProvider (21.3)
using System.Collections;
using System.Collections.Generic;
Leaving out System.Collections (as I did) results in a "Using the generic type System.Collections.Generic.IList<T> requires 1 type arguments". Although this may seem minor, I spent a while trying to figure this out, and it's a great sample, so would hate to see others give up trying to implement this...
Note from the Author or Editor: I'm working on 2nd edition of book and being more explicit about adding namespace delcarations since this seems not to have been so obvious to a number of readers. Thanks for validating this decision.
|
Ren Hammington |
|
| Printed |
Page 43
2nd Line |
-The name of the EntityContainer is "dbo," .....
Should be:
-The name of the EntityContainer is "ProgrammingEFDB1ModelStoreContainer" .....
Note from the Author or Editor: In addition to replacing dbo with ProgrammingEFDB1ModelStoreContainer, please remove the word "schema" from the sentence. It should read:
The name of the EntityContainer is “ProgrammingEFDB1ModelStoreContainer,” which was derived from the database name.
|
Kam_UK |
May 2009 |
| Printed |
Page 44
2nd line of the last paragraph |
...without a reference to a row in the People table. ...
Should be:
...without a reference to a row in the Contact table. ...
|
Kam_UK |
May 2009 |
| PDF |
Page 48
2nd and 3rd paragraph |
Maybe I missed something, but here (at the top of 48):
Figure 2-20 displays the MappingAssociation for the CSDL’s FK_Contact_People association
in the Designer. You can open this by right-clicking on an association in the
Designer and selecting Table Mapping.
Shouldn't that be FK_Contact_Address instead of FK_Contact_People ? Not sure where people came from. This also happens again in the next paragraph. Great book by the way!
Note from the Author or Editor: Yes, should be FK_Contact_Address.
|
Josh Williams |
May 2009 |
| Printed |
Page 59
Last Paragraph |
The last sentence on page 59 mentions the following, "But as you will learn later in this book, because IQueryable inherits from ObjectQuery, it is possible to cast IQueryable to an ObjectQuery and then access those properties and methods".
The incorrect part of this statement is that "IQueryable inherits from ObjectQuery". It should say "ObjectQuery implements the IQueryable interface"
Below is the ObjectQuery class declaration.
class ObjectQuery<T> : ObjectQuery, IOrderedQueryable<T>, IQueryable<T>, IEnumerable<T>, IOrderedQueryable, IQueryable, IEnumerable, IListSource
Note from the Author or Editor: Change sentence to:
But as you will learn later in this book, it is possible to cast IQueryable to an ObjectQuery and then access those properties and methods.
|
BarDev1 |
May 2009 |
| PDF |
Page 62
In the C# Code |
In this line of code:
var contacts = new ObjectQuery<Contact>(queryString, context);
ObjectQuery is not recognized unless you include a "using System.Data.Objects;" at the top of the file.
Minor detail, but it took me 20 minutes to find the right namespace to import. Just thought I would pass it along.
Note from the Author or Editor: can you add a note somewhere on this page that says:
The namespaces in many of the examples are not spelled out along with the classes. Be sure to reference the appropriate namespaces at the top of your code files with Include for Visual Basic and using for C#. For example, for the ObjectQuery class you'll need Include System.Data.Objects (VB) or using System.Data.Objects; (C#).
(to editor: please use literal format for the words Include and using in the 2nd sentence and for the short statements in the last sentence (Include System.Data.Objects AND using System.Data.Objects; ))
|
Josh Williams |
May 2009 |
| Printed |
Page 62
2nd paragraph under the heading "The Parameterized ObjectQuery" |
To use a parameterized query, you need to explicitly instantiate an ObjectQuery, rather than using the CreateQuery method of the ObjectContext.
I don't think the above is true. You can pass parameters even if you instantiate the object using CreateQuery:
string qstr =
"SELECT VALUE c FROM programmingEFDB1Entities.Contacts AS c WHERE c.FirstName = @firstName";
var contacts = context.CreateQuery<Contact>(qstr);
contacts.Parameters.Add(new ObjectParameter("firstName", "Robert"));
Note from the Author or Editor: To use a parameterized query, you can add parameters to an ObjectQuery created with the CreateQuery method of the ObjectContext or to one which you have instantiated explicitly, as shown in the following example.
|
Kam_UK |
May 2009 |
| Printed |
Page 64
C# Example of Lambda Expression |
The example in the book:
var contacts = context.Contacts
.Where(c => c.FirstName == 'Roberts');
The single quotations around Roberts is incorrect. Roberts should be surrounded by double quotation marks.
I do not have much experience with Lambda expressions, but the code would not compile when Roberts is surrounded by single quotation marks. When I surrounded Roberts with double quotation marks, the application compiled and seemed to work correctly.
|
BarDev1 |
May 2009 |
| Printed |
Page 88
Example 4-9, C# version |
Please replace "United Kingdom" with "UK".
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 90
Example 4-12 C# code snippet |
The Where clause is filtering on "United Kingdom" and should be "UK"
Note from the Author or Editor: goes along with the same modification for example 4-9.
|
Fernando Soto |
May 2009 |
| Printed |
Page 96
Example 4-25 |
Missing parenthesis in the statement. Should be:
SELECT c.LastName,
ANYELEMENT(SELECT VALUE MAX(a.PostalCode)
FROM c.Addresses AS a)
FROM PEF.Contacts AS c
Note from the Author or Editor: Please fix as noted
|
Bryan Owczarzak |
Sep 2009 |
| Printed |
Page 98
Example 4-28 |
Third line of code snippet:
ON variable.commonproperty EQUALS variableB.commonProperty
Should mostly be:
ON variableA.commonproperty EQUALS variableB.commonProperty
|
Fernando Soto |
May 2009 |
| Printed |
Page 101
Example 4-36 |
I tried to run example 4-36 and received the following error:
System.Data.EntitySqlException was unhandled
Message="'oa.FirstName' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near multipart identifier, line 1, column 8."
Source="System.Data.Entity"
Column=8
ErrorContext="multipart identifier"
ErrorDescription="'oa.FirstName' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly."
There was a lot more but I cut it out for the sake of brevity.
However, I changed to oa.FirstName, oa.LastName to be Add.FirstName and Add.LastName and all worked as it should.
Note from the Author or Editor: p 101, example 4-36
change FIRST line of exmaple to
SELECT add.FirstName, add.LastName
|
CyclingFoodmanPA |
Sep 2009 |
| Printed |
Page 102
Next to last paragraph |
syntax Group By MyTitle = Title
Should be
syntax Group By MyTitle = c.Title
|
Fernando Soto |
May 2009 |
| Printed |
Page 113
Example 4-53 C# 4th line |
if (address.CountryRegion ==
|
Greg Lee |
|
| Printed |
Page 121
last dot on page 121 |
>Query projecting a single value that is an entity:
>
>SELECT VALUE c FROM PEF.Contacts AS c
>
>Each row of the DataReader that results is a DbDataRecord with one >column. The column contains an IExtendedDataRecord, which is a type >of a DbDataRecord. There is one column for every property in a >Contact entity, filled with the relevant data.
The query should goes without VALUE keyword:
SELECT c FROM PEF.Contacts AS c
Note from the Author or Editor: Please make the change indicated above.
|
Krzysiek Śliwa |
|
| Printed |
Page 131
2nd to last paragraph |
Please add
", which is in the System.Data namespace,"
into the first sentence of this paragraph so that it reads:
The EntityKey, which is in the System.Data namespace, is passed into the ..
Note that System.Data should be formatted similarly to the word EntityKey.
Thanks.
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 144
Section "What about the stored procedure?" |
The narrative explains that the CustomersbyState stored procedure returns rows from the Customer table and that the Customer table maps to the Customer entity.
At this point in the book we only have Address and Contact tables and entities.
The CustomersbyState stored procedure actually returns rows from the Contact table and in the next sections and Figures 6-5 and 6-6 we are shown how to map the CustomersbyState procedure to the Contact entity.
The references to Customer table and entity in the "What about the stored procedure?" section need to be changed to Contact table and entity.
Note from the Author or Editor: Oy vey! Need to replace the word "Customer" with COntact in the following locations.
1) 4th paragraph (starts with "So far,...". "from the Customer table." should be "from the Contact table."
2) 5th paragraph, replace "from the Customer table" with "from the Contact table"
3) 5th paragraph, replace "to the Customer entity" with "to the Contact entity"
4) 5th paragraph, replace "equates to a Customer entity" with "equates to a Contact entity"
Thanks
|
Don DeCosta |
May 2009 |
| Printed |
Page 153
paragraph labeled 5. |
When run BreakAway creation script, then create EDM:
No sysdiagrams table exists. No sps related to diagrams are created. Using SQL 2008. This seems to be related to problem that by default objects required for system diagram in a database are not present. You must select on Database Diagrams to create New Database Diagram, and then even if you do not add tables, system objects required are added. Of course these do not exist when running BreakAway script to create database, thus no sysdiagrams, etc, which are referenced in this paragraph. The script has code trying to create sys.sp_addextendedproperty @name=N'MS_DiagramPane1', and I can find no reference to this in the database, nor do I understand what this is doing. Is it related to the sysdiagram?
I spent a little time with 'Teh Google', and although there are hints one can create a default Database Diagram setup with objects in the Model database, so this ability is by default added to any new database created, I have not yet found out where anyone was kind enough to explain just HOW to do it.
Anyway, this leaves us not certain as to whether anything we might need failed to be created by the script. Some clarification would be nice.
Note from the Author or Editor: Please turn the paragraph into a TIP.
Modify the first sentence of that note to read:
If you have created a database diagram in the database, you would see a table named sysdiagrams in the list of tables.
|
Anonymous |
|
| Printed |
Page 156
10th row in Table 7-2 |
Lodging Destinations Destination
also should be
Lodging Locations Destination
Note from the Author or Editor: thanks
|
Ryohsuke Fujioka |
|
| Printed |
Page 156
5th row in Table 7-2 |
Trip Destinations Destination
Should be:
Trip Locations Destination
Note from the Author or Editor: under the column called "Original navigation property name" please change "Destinations" on the 5th row to "Locations"
|
Kam_UK |
May 2009 |
| Printed |
Page 165
In section BAGA assembly name second paragraph |
The paragraph states:
Open the project's Properties window, and on the first page, Application, change the root namespace to BAGA.
Should read somthing like:
Open the project's Properties window, and on the first page, Application, change the root namespace, VB, default namespace, C#, to BAGA.
Note from the Author or Editor: Open the project's Properties window, and on the first page, Application, change the root namespace (VB)/default namespace (C#) to BAGA.
|
Fernando Soto |
May 2009 |
| Printed |
Page 166
3rd paragraph |
On Page 166, the paragraph starts with: "Figure 7-11 shows..." I believe it should say "Figure 7-12 shows..."
Note from the Author or Editor: There is a problem with images 7-11 and 7-12. The one that is currently 7-11 (a screen shot of properties) should be the imaage displayed in figure 7-12 on p. 167. The one displayed in 7-12 should (Lutz Roeder's ....) should have been displayed in Figure 7-11. However, that one (Lutz Roeder's) should be completely replaced with a new screenshot. I th ought I sent this to you before the book went to print. The product is now "Red Gate's .NET Reflector". I will send the image to Loranah Dimant this morning (March 26th)
|
moflaherty |
May 2009 |
| Printed |
Page 180
2nd paragraph from the bottom |
Second paragraph from the bottom, 'Edit the grid's columns' the second line word 'Trim' should be 'Trip'.
|
RezaMohamed |
May 2009 |
| Printed |
Page 182
VB fragment |
The second line of the VB is missing the "n" at the end of "resDateColumn":
.Columns(resDateColumn.Index) _
|
Mike Bridge |
|
| Printed |
Page 188
Paragraph titled "Test editing a customer" |
Unless a person is experienced in winforms programming they are unlikely to know that it is necessary to tab out of a field (or otherwise blur it) in order to commit any changes. This must be done prior to saving or navigating to the next record (seems like a navigation to the next record should do this too, but it doesn't). You might put one of those little "trap" notes about this below the paragraph.
Note from the Author or Editor: done in 2nd edition
|
Bill Hyde |
|
| Printed |
Page 188
First C# code sample on page |
The VB and C# code don't match. The narrative explains that we'll be setting DataSources for activity and destination so the VB code matches the narrative but the C# code sets DataSources for customer and destination.
Note from the Author or Editor: top of page, C# sample
first line begins with "customerBindingSource"
replace that line with :
activityBindingSource.DataSource = activities;
|
Don DeCosta |
May 2009 |
| Printed |
Page 188
First sentence on the page |
Up to this point the book tells us to add two class level variables, Example 8-3 page 186, modify the form load event, Example 8-4 page 186, and add the method FillCombos, Example 8-5 page 187. On the top of page 188 we are told that we can run the application again to see how the ComboBoxes have been populated. But no instruction was made to make a call to FillCombos and so the ComboBoxes are not populated. I add the following to Example 8-4 on page 186 to the end of the code snippets.
VB FillCombos()
C# Fillcombos();
Note from the Author or Editor: At the top of page 188, please modify the paragraph that currently reads:
"Run the application again if you want to see how the ComboBoxes have been populated so far."
Add BEFORE that sentence:
Insert a call to the FillCombos method (FillCombos for VB or FillCombos(); for C#) into the form's Load event You can put this line at the end of the existing code.
Please note that all three instances of the word FillCombos should be formatted as literal text. The third instance should also include the (); in the literal formatting.
|
Fernando Soto |
May 2009 |
| Printed |
Page 192
First c# code snippet |
3 issues in this code snippet
1) "Now" is not valid on its own. For c# is should be "DateTime.Now".
2) Last line of code has "_adding". It should be "adding".
3) When creating the new BAGA.Contact you cannot use the default constructor (ie: new BAGA.Contact();). I am assuming you need to use the factory method (ie: BAGA.Contact.CreateContact(.....)). However if the new factory method is used it is unclear what values to pass into CreateContact for the arguments (ie: what would I put for ContactID?).
Note from the Author or Editor: 1) Change "Now" to "DateTime.Now" in the C# snippet.
2) p. 191 (VB sample) replace "_adding" with "adding"
3) p. 192 (end of VB sample) replace "_adding" with "adding"
4) p. 192 (end of C# sample) replace "_adding" with "adding"
Reader's comment #3 is incorrect. Resharper was suggesting that he replace the code with an object initializer which was confusing. The code in the book is correct.
|
James Steele |
May 2009 |
| Printed |
Page 196
2nd paragraph after code listing |
Text says:
Note from the Author or Editor: ecch - editing issues.
1) Please remove the entire paragraph in question: "you can return the selection lists..."
2) top of p. 197, (vb code sample 8-11 continued from p. 196)
in first line of code, replace "Dim tripResults" with "trips"
thanks.
|
Pete Sutcliffe |
|
| Printed |
Page 207
Halfway |
Example 8.18
In the VB portion, on the first set of code, should read, "New SortDescription" ....
Currently, it's showing as one word NewSortDescription
|
Paul Mc |
|
| Printed |
Page 207
Halfway |
The C# and VB code do not match
c# lstBoxTrips.Items.SortDescriptions.Add(new SortDescription("StartDate", ListSortDirection.Ascending));
should read
lstBoxTrips.Items.SortDescriptions.Add(new SortDescription("StartDate", ListSortDirection.Descending));
|
Will Ferguson |
May 2009 |
| Printed |
Page 209
5th paragraph |
Text says
Note from the Author or Editor: Should read:
It's worth the effort to use this rather than the generic List so that you
|
Pete Sutcliffe |
|
| Printed |
Page 209
First set of code snippets |
The C# code does not have a data type. Change
private ObservableTrips = new ObservableCollection<Trip>();
To
private ObservableCollection<Trip> ObservableTrips = new ObservableCollection<Trip>();
|
Fernando Soto |
May 2009 |
| Printed |
Page 211
Example 8-21 |
This code will only validate the first Trip in newTrips. The "Else Return True" in the For Each block will return if the first Trip is valid and Trip 2...n will never get tested.
Maybe something like this instead:
Function validateNewTrips() As Boolean
Dim newTrips = From t In ObservableTrips _
.Where(Function(t) t.TripId = 0)
For Each Trip In newTrips
If Trip.Lodging Is Nothing Then
Return False
ElseIf Trip.StartDate < Today Then
Return False
ElseIf Trip.EndDate < Trip.StartDate Then
Return False
End If
Next
' All must have been good
Return True
End Function
Note from the Author or Editor: edits to VB example
remove the 11th & 12th line of the code sample that read
Else
Return True
Modify the 2nd to last line of the VB to read:
Return True 'when newTrips.Count=0 or all trips validate
In C# sample, same changes:
remove:
else
return true;
then modify 2nd to last line adding "or all trips validate" at the end
|
Don DeCosta |
May 2009 |
| Printed |
Page 211
Top of page. |
In the C# code the \\ is being used as the start of a comment line. The correct characters should be // ....
|
Fernando Soto |
May 2009 |
| Printed |
Page 232
1st paragraph under The EntityState enums section |
On page 232
Note from the Author or Editor: Modify the sentence below "The EntityState enums" to
The EntityState property of an entity identifies whether the entity is:
|
BillHyde |
Sep 2009 |
| Printed |
Page 291
Setting up the DropDownList |
One thing to be sure of is that the DropDownList has "Enable AutoPostBack" checked so that the upcoming binding to a dependent DetailsView will update as expected.
Note from the Author or Editor: On page 291, there's a numbered list of steps. Please insert this item in between the current #3 and #4 and of course, increase the numbers for the items that follow it.
4. In the DropDownList's TaskList, check the "Enable AutoPostBack" CheckBox. This will ensure the correct behavior each time the user selects an item from the list.
Thanks!
|
Brian Hilltop |
May 2009 |
| Printed |
Page 299
United States |
I was building the ASP.NET application from scratch when I found that after changing the combobox at the top of web page the corresponding payment listview did not remain in synch with currently selected Contact. I tried downloading your sample code and found the same problem. It seems that after I selected the combobox multiple times the payment details that showed up in ListView was for the previous selected Contact not the currently selected one. The inital web page that is displayed does have the correct information. Additionally, if the reservation listbox is selected by manually the payment details update correctly. I am concerned that somehow the postback events are being fired before the data is actually updated thus casuing the out of synch behavior I am observing. Please confirm that you can replicate the problem I am describing and let me know if you can come up with a solution. I am looking to use Entity Framework in a similar application and want to know if there is reason for concern with this data synchronization issue. I have tried many permutations to resolve this problem (i.e., clearing listview manually, changing listbox selection to -1 and then selecting to zero if reservation exist, etc.) and have not gotten this simple example to work correctly. A little heavy on the errata but great book nonetheless!
Thanks,
Joe
Note from the Author or Editor: noted for 2nd edition
|
Joseph Isaacs |
|
| Printed |
Page 308
Top of page. |
The first sentence states:
1. Create the first association by dragging an Association control from the ToolBox and attaching one end to Customer and the other to Activity.
If you attempt to drag the Association control onto the designer your cursor will change to and O with a line through it meaning that the operation can not be done. The sentence should read something like:
1. Create the first association by selecting the Association control from the ToolBox and then positioning the cursor on the Customer entity and left click on it and then moving the cursor on to the Activity entity and click on it.
Note from the Author or Editor: change sentence to
Create the first association by selecting the Association control from the ToolBox and positioning the cursor on the Customer entity. Click on the Customer entity, which will set the first end of the association, then click the Activity entity to set the other end of the association.
|
Fernando Soto |
May 2009 |
| Printed |
Page 321
Example 12-3 |
The C# code has a couple of issues.
1. This line of code is incomplete. Needs the time stamp fields to be
added for both the Contacts and Customers tables
var newCust = Customer.CreateCustomer(0, "Nola", "Claire", DateTime.Now, DateTime.Now);
Modified code:
// Initialize two TimeSpamp's for the call to CreateCustomer
byte[] contactTimestamp = new byte[] {0,0,0,0,0,0,0,0};
byte[] customerTimestamp = new byte[] {0,0,0,0,0,0,0,0};
var newCust = Customer.CreateCustomer(0, "Nola", "Claire", DateTime.Now, DateTime.Now,
contactTimestamp, customerTimestamp);
2. The following error is thrown when SaveChanges is executed and the following statement is not added.
Entities in 'BAEntities.Contacts' participate in the 'FK_Customers_CustomerTypes'
relationship. 0 related 'CustomerTypes' were found. 1 'CustomerTypes' is expected.
Added the following line of code which adds a CustomerType "Silver" to the new Customer:
newCust.CustomerType = context.CustomerTypes
.Where(ct => ct.CustomerTypeName == "Silver").Select(ct => ct).First();
3. The following query:
// Query for a Customer and modify a new property
var firstCust = (from c in context.Contacts.OfType<Customer>()
select c).FirstOrDefault();
Returns a record whos BirthDate field is already set to 1/24/1981 so the following line should not cause the DB to be updated because you are modifying the field with the same value therefore no change.
firstCust.BirthDate = new DateTime(1981, 1, 24);
Note from the Author or Editor: #1 is correct, please implement it
#2 is wrong - do not implement the proposed change. That setting is performed in SavingChanges
#3 change that line of code so that it is (1981,1, 26)
|
Fernando Soto |
May 2009 |
| Printed |
Page 379
2nd & 4th paragraph |
Printed "The BreakAway database has a stored procedure called CreateCustomerfromClient".
Actual stored procedure's name is CreateCustomerfromContact.
In paragraph 4 was used the same erroneous reference.
Note from the Author or Editor: Be sure to change both instances of this. Thanks!
|
Vitaly |
May 2009 |
| Printed |
Page 431
Top Of Page: First C# Code Section |
When new reservations are added to an existing Customer, the code adds the new reservations to the variable "customerToUpdate". This variable represents the customer retrieved from the database for the purpose of initiating state tracking. But when updating existing reservations, the "customer" variable is utilized. This variable represents the recently edited customer.
Why not use the "customer" variable for both edits and inserts? If the EntityFrameWork understands updated Reservations for the "customer" variable, won't it also understand inserted Reservations for that same variable? (I understand that the Trip would still have to be adjusted for a Reservation insert.)
Thanks,
Mark
Note from the Author or Editor: in this example, 2nd code line frmo the BOTTOM of the example, change
custtoUpdate.Resrvations.Add(res);
to
customer.Reservations.Add(res);
|
Mark Phillips |
|
| Printed |
Page 503
Table 16-1 |
The entries in difference column for lines 2, 4 and 5 are incorrect:
If 108 ms is 8% difference, then 320 ms, 412 ms and 207 ms difference are 320%, 412% and 207% difference respectivly.
Note from the Author or Editor: please remove the difference from base column completely
|
Anonymous |
|
| Printed |
Page 728
Example 22-8 |
In the VB sample, please move the line "End Using" so that it is just above the line "End Function". This will impact the tabbing. It should look like this:
Public Function GetTrips() As List(Of BAGA.DTO.Trip) _
Implements ICustomerService.GetTrips
Using listProvider As New BAGA.Providers.ListProvider
Dim tripsList = CType(ListProvider.GetReferenceList(Of Trip)(""), _
List(Of Trip))
Dim trips = From t In tripsList _
Select New BAGA.DTO.Trip With _
{.TripID = t.TripID, .TripDetails = t.TripDetails}
Return trips.ToList
End Using
End Function
In the C# sample, we need to move the first closing brace down so that it is just above the 2nd closing brace. Tabs affected here too.
public List<BAGA.DTO.Trip> GetTripsDTO()
{
using (var listProvider=new BAGA.Providers.ListProvider())
{
List<Trip> tripsList = (List<Trip>)listProvider.GetReferenceList<Trip>("");
var trips =
from t in tripsList
select new BAGA.DTO.Trip
{TripID = t.TripID, TripDetails = t.TripDetails};
return trips.ToList();
}
}
Note from the Author or Editor: It looks like my attempt to show how to format the tabbing got wiped out by the submittal form. Please check with me when it's time to make this fix and I can show you what it should look like.
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 736
2nd to last line of code on page |
Please remove the line "add.TimeStamp=originalTS" that is just above "Next". This was accidentally left over when modifying the book's text to match refactored code.
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 738
Example 22-15 bottom of page |
More problems caused by updating the book's text after refactoring the code sample.
1)
Please change the line JUST ABOVE "Step 4" so that it says
"If custEF.EntityState_Local" instead of "If cust.EntityState_Local"
2)
Line just above "Step 2" should be:
"Using context = New BAEntities"
instead of "Using context = New BreakAwayEntities"
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 739
top, code sample |
place curly braces before and after the first line which is a comment.
SHould look like:
{
//we're not deleting customers
}
Note that there should be two paces in front of the middle line.
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 746
middle of page - example 22-19 |
replacing RemoveChild method in C# sample
Here is the new C# version:
This form will mess up indentation, so please note:
2 spaces in front of third line. -->if (childEntity...
4 spaces in front of 4th line -->((Address)childEntity...
2 spaces in front of 5th line ---> if(childEntity...)
4 spaces in front of 6th line -->((Reservation)childEntity...
public void RemoveChild(object childEntity)
{
if (childEntity is Address)
((Address)childEntity).EntityState_Local = EntityStateLocal.Deleted;
if (childEntity is Reservation)
((Reservation)childEntity).EntityState_Local = EntityStateLocal.Deleted;
}
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 748
bottom of page, 2nd line from the bottom |
2nd line from the bottom should be
var add = cust.Addresses[i];
(replacing parens with square brackets)
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 750-751
C# sample |
Issues with last minute changes to text of C# code sample. (Readers can download the correct code sample from learnentityframework.com/downloads).
Starting with where the C# example begins in the middle of the page.
4th line should end with: GetCustomerList(); <--adding parens
5th line should end with: GetTripList(); <--adding parens
9th line: [randomPositioninList] <--replacing parens with square brackets
13th line: DateTime.Now.ToShortDateString(); <--adding "DateTime."
18: [cust.Reservation.Count-1]; <--replacing parens with square brackets
20 cust.RemoveChild(reslast); <--reslast replaces lengthy parameter
On page 749 where sample continues
5th line from top: Reservation[i]; <--replacing parens with square brackets
EDITOR: Please contact me (author) with any questions!
Note from the Author or Editor: the note about p. 749 is accurate, I got my papers shuffled around. It's just part of a different sample.
|
 Julia Lerman
|
May 2009 |
| Printed |
Page 751
code sample at top of page |
4th code line down, modifying code line and then adding another line of code below it.
var trip = triplist[randomPositioninList];
res.TripID = trip.TripID;
10th line down
var add = cust.Addresses[0]; <--replacing parens with square brackets
|
 Julia Lerman
|
May 2009 |