Errata

Building Enterprise Applications with Windows Presentation Foundation and the Model View ViewModel Pattern

Errata for Building Enterprise Applications with Windows Presentation Foundation and the Model View ViewModel Pattern

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
xvi
Code Samples

After I opened 9780735650923_files.zip and tried to "rebuild All" "CRM Domain Model" solution (10 projects), I was getting the following errors:
Project CRM.MVVM.WPF:
1.
Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "AvalonDock, Version=1.3.3548.0, Culture=neutral, PublicKeyToken=85a1e0ada7ec13e4". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2. C:\MVVM_files\Final code\SampleApplication\CRM.MVVM.WPF\MainWindow.xaml(88,14): error MC3074: The tag 'DockingManager' does not exist in XML namespace 'clr-namespace:AvalonDock;assembly=AvalonDock'. Line 88 Position 14.

Dmitriy Gorbachev  May 20, 2013 
Other Digital Version 19
1st paragraph

This is the Amazon version as displayed on an iPad in the "Layers, Tiers, and Services" section.

You write:

"In a common three-tier application such as an MVVM application ... two/three layers per tier and two tiers."

Further (page 21) it mentions the "Business tier" which would make it a three tier application, although this is not reflected in the diagram on page 20.

Thanks
Ian

Ian Bradley  Jul 27, 2011 
Printed Page 34
3rd paragraph

MVC can can consume

"can" is repeated twice

Dmytro S. Yefymov  Sep 09, 2013 
PDF Page 41
OnPropertyChanged method

OnPropertyChanged method is implemented in the book as follows:

public void OnPropertyChanged(string name)
{
var handler = PropertyChanged;
if (handler != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}

Even though it is syntactically correct, it doesn't make any sense. First the event handler named "PropertyChanged" is copied into "handler", but then after checking if "handler" is null, the writer goes ahead and calls "PropertyChanged" rather than "handler". So in the end, it doesn't make any sense to copy "PropertyChanged" into "handler".

The correct way should be:

public void OnPropertyChanged(string name)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}

Anonymous  Apr 14, 2013 
Printed Page 56
FluentEmployee constructore

The original constructor in the book contains the statement to create the FluentEmployee instance; the problem is that the class is static so the statc method Init(), as per example on page 57, will always return nul for the fluent object and fail on the FirstName assignment.
In order to make it work you can add another CreateInstance method before the Init() method or, as I suggest, the declarative for the fluent variable should contains the initializer as well:

public static IFluentEmployee fluent = new FluentEmployee();

In this way everything works perfectly and we didn't break any logic.

Thanks, Adriano Palmieri.

Adriano Palmieri  Jun 20, 2011 
Printed Page 56
Constructor for FluentEmployee

The constructor creates another instance of the class, resulting in an endless loop.

Philip Uren  Oct 19, 2013 
PDF Page 65
dto lambda aggregate function syntax error (code sample)

this is wrong:

.Aggregate(new List<EmployeeDto>() => (list, obj)
{
etc

should be:
.Aggregate(new List<EmployeeDto>(), (list, obj) =>
{
etc

Frank  Jul 09, 2011 
Printed Page 84
4th line from the top

The foreach loop set IsDefault to false for ALL contacts, but if the current contact is already in the list, it's IsDefault flag will get set to false too. Therefore the foreach loop needs to exclude Contacts where cont == contact.

Philip Uren  Oct 19, 2013 
PDF Page 86
Australia

The validation attrributes of State, Country & ZipCode all say 'AddressLine1 is a mandatory field'

Anonymous  Jun 21, 2012 
Printed Page 115
namespace CRM.Dal.EF ...

public class CRMObjectContext : ObjectContext
{
public CRMObjectContext(string connectionString)
: base(connectionString)
{
public ObjectSet<Employee>Employees{get;set;}
public ObjectSet<Customere>Customers{get;set;}
}
}

Are we declaring properties inside a constructor?


Dmytro S. Yefymov  Sep 09, 2013 
Printed Page 116
public void CommitTransaction()

public void CommitTransaction()
{
try
{
if (tx == null)
throw new TransactionException("...");
...
}
...
finally
{
tx.Dispose();
}
}

If tx is null, why we dispose it at the end?

Dmytro S. Yefymov  Sep 09, 2013 
146
CustomerFacade

In the business layer you have a CustomerFacade with a public bool CanAddOrder(Order order). Inside this method you also have the line this.Entity.AddOrder(order). Does this really belong inside here, seeing that the method is named CanAddOrder and return a bool, it seems that the actual AddOrder(order) belongs to the class calling CanAddOrder instead of inside it. Could you clarify this?

Also it would be nice if the companion code included the WF code and used it in the CustomerFacade.

Jakob N?tseth  Jan 04, 2012 
Printed, PDF Page 151
last line of sample code

current version of code

public void SetViewModel(PersonModel dataSource)
{
this.DataSource = dataSource;
}

public void SetViewModel(PersonViewModel dataSource)
{
this.DataSource = dataSource;
}

PersonModel should be replaced with PersonViewModel

Anonymous  Jun 04, 2013 
Printed Page 180
2nd paragraph

"Laurent Bugnion is a great developer the recipient of ..." should have "and" after "developer", e.g. "Lauranet Bugnion is a great developer and the recipient...".

Philip Uren  Oct 19, 2013 
Printed Page 182
6th paragraph

"[InportingConstructor]" should be "[ImportingConstructor]" (should be letter m, not n).

Philip Uren  Oct 19, 2013