100% found this document useful (2 votes)
49 views

Programming Entity Framework Building Data Centric Apps with the ADO NET Entity Framework Second Edition Julia Lerman download

The document provides information on the book 'Programming Entity Framework: Building Data Centric Apps with the ADO.NET Entity Framework, Second Edition' by Julia Lerman, which covers the fundamentals of using the Entity Framework for data-centric applications. It includes details about the book's content, structure, and various topics such as querying, modifying entities, and data binding. Additionally, it offers links to download the book and other related resources.

Uploaded by

waradegha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
49 views

Programming Entity Framework Building Data Centric Apps with the ADO NET Entity Framework Second Edition Julia Lerman download

The document provides information on the book 'Programming Entity Framework: Building Data Centric Apps with the ADO.NET Entity Framework, Second Edition' by Julia Lerman, which covers the fundamentals of using the Entity Framework for data-centric applications. It includes details about the book's content, structure, and various topics such as querying, modifying entities, and data binding. Additionally, it offers links to download the book and other related resources.

Uploaded by

waradegha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Programming Entity Framework Building Data

Centric Apps with the ADO NET Entity Framework


Second Edition Julia Lerman pdf download

https://ebookfinal.com/download/programming-entity-framework-
building-data-centric-apps-with-the-ado-net-entity-framework-
second-edition-julia-lerman/

Explore and download more ebooks or textbooks


at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.

Entity Framework 6 Recipes Second Edition Driscoll

https://ebookfinal.com/download/entity-framework-6-recipes-second-
edition-driscoll/

Entity Framework Core Cookbook 2nd Edition Ricardo Peres

https://ebookfinal.com/download/entity-framework-core-cookbook-2nd-
edition-ricardo-peres/

WCF Multi Layer Services Development with Entity Framework


4th Edition Edition Mike Liu

https://ebookfinal.com/download/wcf-multi-layer-services-development-
with-entity-framework-4th-edition-edition-mike-liu/

Programming Microsoft LINQ in NET Framework 4 1st Edition


Pialorsi

https://ebookfinal.com/download/programming-microsoft-linq-in-net-
framework-4-1st-edition-pialorsi/
Programming NET Compact Framework 3 5 2nd Edition Paul Yao

https://ebookfinal.com/download/programming-net-compact-
framework-3-5-2nd-edition-paul-yao/

Murach s ADO NET 4 Database Programming with C 2010 4th


Edition Anne Boehm

https://ebookfinal.com/download/murach-s-ado-net-4-database-
programming-with-c-2010-4th-edition-anne-boehm/

ASP NET MVC Framework Unleashed 1st Edition Stephen


Walther

https://ebookfinal.com/download/asp-net-mvc-framework-unleashed-1st-
edition-stephen-walther/

Net Framework Essentials 1 ed Edition Thuan L. Thai

https://ebookfinal.com/download/net-framework-essentials-1-ed-edition-
thuan-l-thai/

Equality The Legal Framework Second Edition Bob Hepple

https://ebookfinal.com/download/equality-the-legal-framework-second-
edition-bob-hepple/
Programming Entity Framework Building Data Centric
Apps with the ADO NET Entity Framework Second
Edition Julia Lerman Digital Instant Download
Author(s): Julia Lerman
ISBN(s): 9780596807269, 0596807260
Edition: Second Edition
File Details: PDF, 9.09 MB
Year: 2010
Language: english
SECOND EDITION

Programming Entity Framework

Julia Lerman

Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo


Programming Entity Framework, Second Edition
by Julia Lerman

Copyright © 2010 Julia Lerman. All rights reserved.


Printed in the United States of America.

Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or [email protected].

Editors: Mike Hendrickson and Laurel Ruma Indexer: Ellen Troutman Zaig
Production Editor: Loranah Dimant Cover Designer: Karen Montgomery
Copyeditor: Audrey Doyle Interior Designer: David Futato
Proofreader: Sada Preisch Illustrator: Robert Romano

Printing History:
February 2009: First Edition.
August 2010: Second Edition.

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Programming Entity Framework, the image of a Seychelles blue pigeon, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
.NET is a registered trademark of Microsoft Corporation.

While every precaution has been taken in the preparation of this book, the publisher and author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.

ISBN: 978-0-596-80726-9

[SB]

1281106344
Table of Contents

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

1. Introducing the ADO.NET Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


The Entity Relationship Model: Programming Against a Model,
Not the Database 2
The Entity Data Model: A Client-Side Data Model 3
Entities: Blueprints for Business Classes 6
The Backend Database: Your Choice 7
Database Providers 8
Access and ODBC 9
Entity Framework Features: APIs and Tools 9
Metadata 10
Entity Data Model Design Tools 10
Object Services 11
POCO Support 12
Change Tracking 12
Relationship Management and Foreign Keys 13
Data Binding 13
n-Tier Development 14
EntityClient 14
The Entity Framework and WCF Services 15
What About ADO.NET DataSets and LINQ to SQL? 15
DataSets 15
LINQ to SQL 16
Entity Framework Pain Points Are Fading Away 16
Programming the Entity Framework 17

2. Exploring the Entity Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19


Why Use an Entity Data Model? 19

iii
The EDM Within the Entity Framework 20
Walkthrough: Building Your First EDM 21
Inspecting the EDM in the Designer Window 24
Entity Container Properties 26
Entity Properties 26
Entity Property Properties 27
The Model’s Supporting Metadata 29
Viewing the Model in the Model Browser 31
Viewing the Model’s Raw XML 31
CSDL: The Conceptual Schema 33
EntityContainer 34
EntitySet 35
EntityType 36
Associations 38
Navigation Property 41
Navigation Properties That Return Collections 42
SSDL: The Store Schema 43
MSL: The Mappings 45
Database Views in the EDM 46
Summary 47

3. Querying Entity Data Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49


Query the Model, Not the Database 49
Your First EDM Query 50
Where Did the Context and Classes Come From? 51
Querying with LINQ to Entities 55
Writing Your First LINQ to Entities Query 55
Querying with Object Services and Entity SQL 57
Why Another Way to Query? 57
Entity SQL 58
The Parameterized ObjectQuery 60
Querying with Methods 61
Querying with LINQ Methods 61
Querying with Query Builder Methods and Entity SQL 64
The Shortest Query 66
ObjectQuery, ObjectSet, and LINQ to Entities 66
Querying with EntityClient to Return Streamed Data 68
EntityConnection and the Connection String 70
EntityCommand 71
ExecuteReader 71
Forward-Only Access to the Fields 71
Translating Entity Queries to Database Queries 71
Pay Attention to the .NET Method’s Impact on Generated SQL 72

iv | Table of Contents
Avoiding Inadvertent Query Execution 74
Summary 75

4. Exploring LINQ to Entities in Greater Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77


Getting Ready with Some New Lingo 78
Projections in Queries 78
Projections in LINQ to Entities 79
VB and C# Syntax Differences 79
LINQ Projections and Special Language Features 80
Projections with LINQ Query Methods 84
Using Navigations in Queries 84
Navigating to an EntityReference 84
Filtering and Sorting with an EntityReference 86
Navigating to Entity Collections 86
Projecting Properties from EntityCollection Entities 87
Filtering and Sorting with EntityCollections 88
Aggregates with EntityCollections 88
Aggregates in LINQ Methods 89
Joins and Nested Queries 90
Joins 90
Nested Queries 91
Grouping 93
Naming Properties When Grouping 94
Chaining Aggregates 95
Filtering on Group Conditions 95
Shaping Data Returned by Queries 97
Limiting Which Related Data Is Returned 99
Loading Related Data 100
Controlling Lazy Loading 101
Explicitly Loading Entity Collections and Entity References 101
Using the Include Method to Eager-Load 103
Pros and Cons of Load and Include 106
Retrieving a Single Entity 107
Retrieving a Single Entity with GetObjectByKey 108
Finding More Query Samples 109
Summary 109

5. Exploring Entity SQL in Greater Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111


Literals in Entity SQL 111
Expressing a DateTime Literal 112
Expressing a Decimal Literal 112
Using Additional Literal Types 112
Projecting in Entity SQL 113

Table of Contents | v
DbDataRecords and Nonscalar Properties 114
Projecting with Query Builder Methods 115
Using Navigation in Entity SQL Queries 115
Navigating to an EntityReference 115
Filtering and Sorting with an EntityReference 116
Filtering and Sorting with EntityCollections 116
Aggregating with EntityCollections 117
Using Entity SQL SET Operators 117
Aggregating with Query Builder Methods 118
Using Joins 118
Nesting Queries 119
Grouping in Entity SQL 120
Returning Entities from an Entity SQL GROUP BY Query 121
Filtering Based on Group Properties 121
Shaping Data with Entity SQL 122
Using Include with an ObjectQuery and Entity SQL 123
Understanding Entity SQL’s Wrapped and Unwrapped Results 124
Entity SQL Rules for Wrapped and Unwrapped Results 126
Digging a Little Deeper into EntityClient’s Results 126
Summary 127

6. Modifying Entities and Saving Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129


Keeping Track of Entities 129
Managing an Entity’s State 130
Saving Changes Back to the Database 131
Inserting New Objects 134
Inserting New Parents and Children 135
Deleting Entities 137
Summary 139

7. Using Stored Procedures with the EDM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141


Updating the Model from a Database 142
Working with Functions 143
Function Attributes 144
Mapping Functions to Entities 146
Mapping Insert, Update, and Delete Functions to an Entity 148
Inspecting Mappings in XML 152
Using Mapped Functions 153
Using the EDM Designer Model Browser to Import Additional
Functions into Your Model 155
Mapping the First of the Read Stored Procedures: ContactsbyState 156
Using Imported Functions 158
Avoiding Inadvertent Client-Side Processing 159

vi | Table of Contents
Mapping a Function to a Scalar Type 159
Mapping a Function to a Complex Type 160
Summary 163

8. Implementing a More Real-World Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165


Introducing the BreakAway Geek Adventures Business Model
and Legacy Database 166
Creating a Separate Project for an EDM 168
Inspecting and Cleaning Up a New EDM 168
Modifying the Names of Entities and Properties 170
Resolving Collisions Between Property Names and Entity Names 172
Cleaning Up Navigation Property Names 172
Setting Default Values 174
Mapping Stored Procedures 175
Using the Use Original Value Checkbox in Update Mappings 176
Working with Many-to-Many Relationships 178
Inspecting the Completed BreakAway Model 181
Building the BreakAway Model Assembly 182
Looking at the Compiled Assembly 183
Splitting Out the Model’s Metadata Files 184
Summary 185

9. Data Binding with Windows Forms and WPF Applications . . . . . . . . . . . . . . . . . . . 187


Data Binding with Windows Forms Applications 187
Creating a Windows Forms Application 188
Using Windows Forms Data Sources 189
Creating an Object Data Source for a Customer Entity 190
Getting an Entity’s Details onto a Form 191
Adding Code to Query an EDM When a Form Loads 194
Binding Without a BindingSource 196
Adding an EntityCollection to the Form 198
Displaying the Properties of Related Data in the Grid 199
Allowing Users to Edit Data 201
Editing Navigation Properties (and Shrinking the Query) 202
Replacing the Navigation Property TextBoxes with ComboBoxes 204
Adding New Customers 208
Deleting Reservations 211
Data Binding with WPF Applications 213
Creating the WPF Form 213
Creating the WPF Project 214
Adding the Necessary Data Source Objects 215
Inspecting the XAML and Code Generated by the Automated
Data Binding 215

Table of Contents | vii


Adding Code to Query the EDM When the Window Loads 216
Customizing the Display of the Controls 218
Selecting an Entity and Viewing Its Details 219
Adding Another EntityCollection to the Mix 222
Editing Entities and Their Related Data 224
Using SortDescriptions to Keep Sorting in Sync with Data Modifica-
tions 225
Adding Items to the Child EntityCollection 226
The Last Task: Adding New Trips to the Catalog 227
Summary 230

10. Working with Object Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231


Where Does Object Services Fit into the Framework? 231
Processing Queries 233
Parsing Queries: From Query to Command Tree to SQL 234
Understanding Query Builder Methods 235
Analyzing a Query with ObjectQuery Methods and Properties 238
Executing Queries with ToList, ToArray, First or Single 241
Executing Queries with the Execute Method 242
Overriding a Default Connection with ObjectContext.Connection 242
Handling Command Execution with EntityClient 244
Materializing Objects 244
Managing Object State 246
Using EntityKey to Manage Objects 246
Merging Results into the Cache with MergeOptions 247
Inspecting ObjectStateEntry 248
Maintaining EntityState 249
Managing Relationships 252
Attaching and Detaching Objects from the ObjectContext 253
Taking Control of ObjectState 257
ObjectStateManager Methods 257
ObjectStateEntry State Methods for Managing State 258
ObjectSet State Methods 259
Sending Changes Back to the Database 259
ObjectContext.SaveChanges 259
Affecting SaveChanges Default Behavior 260
Overriding SaveChanges Completely 261
Data Validation with the SavingChanges Event 261
Concurrency Management 261
Transaction Support 262
Implementing Serialization, Data Binding, and More 263
Object Services Supports XML and Binary Serialization 263
Object Services Supports Data Binding 265

viii | Table of Contents


Summary 266

11. Customizing Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267


Partial Classes 267
Using Partial Methods 269
The OnContextCreated Method 269
The On[Property]Changed and On[Property]Changing Methods 271
Using PropertyChanged to Calculate Database-Computed Columns
Locally 273
Subscribing to Event Handlers 274
The ObjectContext.ObjectMaterialized Event 275
The ObjectContext.SavingChanges Event 276
The EntityObject.PropertyChanging
and EntityObject.PropertyChanged Events 280
The AssociationChanged Event 282
Creating Your Own Partial Methods and Properties 284
Overriding the Object Constructor 284
Overriding ObjectContext.SaveChanges 285
Creating Custom Properties 286
Overloading Entity Creation Methods 289
Using Partial Classes for More Than Just Overriding Methods
and Events 290
Overriding Default Code Generation 291
Switching to a Template 292
Reading the Template 292
Modifying the Template 293
Customizing a Template for Major Class Modifications 295
Switching Between the Default Template and a Custom Template 295
Summary 296

12. Data Binding with RAD ASP.NET Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297


Using the EntityDataSource Control to Access Flat Data 298
Creating the Hello Entities Project 298
Creating a GridView and an EntityDataSource Concurrently 299
Configuring an EntityDataSource with Its Wizard 299
Formatting the GridView 301
Testing the Web Application 303
Understanding How the EntityDataSource Retrieves and Updates
Your Data 304
EntityDataSource and Its Query 304
EntityDataSource and Its ObjectContext 305
EntityDataSource Context Events 306
EntityDataSource and ViewState 306

Table of Contents | ix
Accessing Foreign Keys When There Is No Foreign Key Property 308
Working with Related EntityReference Data 309
Using EntityDataSource.Include to Get Related Data 309
Displaying Data That Comes from EntityReference
Navigation Properties 310
Using a New EntityDataSource Control to Enable Editing
of EntityReference Navigation Properties 312
Editing EntityReferences That Cannot Be Satisfied
with a Drop-Down List 313
Binding an EntityDataSource to Another Control
with WhereParameters 314
Editing Related Data Concurrently with Multiple
EntityDataSource Controls 316
Working with Hierarchical Data in a Master/Detail Form 317
Setting Up the Web Application 317
Specifying Your Own Entity SQL Query Expression
for an EntityDataSource 318
Binding a DropDownList to an EntityDataSource Control 319
Creating a Parent EntityDataSource That Is Controlled
by the DropDownList and Provides Data to a DetailsView 320
Using the EntityDataSource.Where Property to Filter Query Results 321
Displaying Read-Only Child Data Through the Parent
EntityDataSource 321
Using a New EntityDataSource to Add a Third Level of Hierarchical
Data to the Master/Detail Form 323
Using the EntityDataSource.Inserting Event to Help with Newly
Added Entities 325
Testing the Application 326
Exploring EntityDataSource Events 327
Building Dynamic Data Websites 329
Summary 332

13. Creating and Using POCO Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335


Creating POCO Classes 336
Creating an ObjectContext Class to Manage the POCOs 339
Change Tracking with POCOs 341
Understanding the Importance of DetectChanges 341
Loading Related Data with POCOs 341
Loading from the Context 342
Lazy Loading from a Dynamic Proxy 342
Exploring and Correcting POCOs’ Impact on Two-Way Relationships 342
Using the DetectChanges Method to Fix Relationships 343
Enabling Classes to Fix Their Own Relationships 344

x | Table of Contents
Using Proxies to Enable Change Notification, Lazy Loading,
and Relationship Fix-Up 345
Change Notification by Proxy 346
Lazy Loading by Proxy 346
Exploring the Proxy Classes 347
Synchronizing Relationships by Proxy 348
Using T4 to Generate POCO Classes 350
Modifying the POCO Template 354
Creating a Model That Works with Preexisting Classes 358
Code First: Using Entity Framework with No Model at All 359
Summary 359

14. Customizing Entity Data Models Using the EDM Designer . . . . . . . . . . . . . . . . . . . . 361
Mapping Table per Type Inheritance for Tables That Describe
Derived Types 362
Mapping TPT Inheritance 363
Querying Inherited Types 365
POCO Classes and Inherited Objects 366
Inserting TPT Inherited Types 366
Specifying or Excluding Derived Types in Queries 368
Creating New Derived Entities When the Base Entity Already Exists 370
TPT with Abstract Types 371
Mapping Unique Foreign Keys 373
Mapping an Entity to More Than One Table 375
Merging Multiple Entities into One 376
Querying, Editing, and Saving a Split Entity 378
Mapping Stored Procedures to Split Tables and More 380
Splitting a Single Table into Multiple Entities 381
Filtering Entities with Conditional Mapping 383
Creating a Conditional Mapping for the Activity Entity 385
Querying, Inserting, and Saving with Conditional Mappings 385
Filtering on Other Types of Conditions 387
Removing the Conditional Mapping from Activity and Re-creating
the Category Property 388
Implementing Table per Hierarchy Inheritance for Tables That Contain
Multiple Types 389
Creating the Resort Derived Type 390
Setting a Default (Computed) Value on the Table Schema 391
Testing the TPH Mapping 392
Choosing to Turn a Base Class into an Abstract Class 393
Creating Complex Types to Encapsulate Sets of Properties 393
Defining a Complex Type 394
Reusing Complex Types 396

Table of Contents | xi
Querying, Creating, and Saving Entities That Contain Complex Types 397
Removing the Complex Types from the Model 398
Using Additional Customization Options 399
Using GUIDs for EntityKeys 399
Mapping Stored Procedures 399
Mapping Multiple Entity Sets per Type 399
Mapping Self-Referencing Associations 400
Summary 401

15. Defining EDM Mappings That Are Not Supported by the Designer . . . . . . . . . . . . . 403
Using Model-Defined Functions 403
Using Model-Defined Functions to Return More Complex Results 407
Consuming the Complex Results 408
Reading the Results from a Complex Function 408
Mapping Table per Concrete (TPC) Type Inheritance for Tables
with Overlapping Fields 409
Using QueryView to Create Read-Only Entities and Other Specialized
Mappings 411
Finding a Common Use Case for QueryView 413
Creating a CustomerNameAndID Entity 413
Creating a QueryView Mapping for CustomerNameAndID 414
Testing the QueryView 416
Deconstructing the QueryView 416
Summary 417

16. Gaining Additional Stored Procedure and View Support in the Raw XML . . . . . . . 419
Reviewing Procedures, Views, and UDFs in the EDM 419
Working with Stored Procedures That Return Data 420
Using Functions That Match an Entity Whose Property Names Have
Been Changed 420
Query Stored Procedures and Inherited Types 421
Composing Queries Against Functions 423
Replacing Stored Procedures with Views for Composability 423
Queries That Return Multiple Result Sets 424
Executing Queries on Demand with ExecuteStoreQuery 424
Querying to a Class That Is Not an Entity 424
Querying into an Entity 425
Adding Native Queries to the Model 426
Defining a Complex Type in the Model Browser 427
Adding Native Views to the Model 429
DefiningQuery Is Already in Your Model 429
Using DefiningQuery to Create Your Own Views 431
Implementing a DefiningQuery 433

xii | Table of Contents


Creating Associations with the New Entity 437
Using DefiningQuery to Solve More Complex Problems 438
Using Commands That Affect the Database 440
Executing SQL on the Fly with ExecuteStoreCommand 440
Using Functions to Manipulate Data in the Database 441
Mapping Insert/Update/Delete to Types Within an Inheritance Structure 444
What If Stored Procedures Affect Multiple Entities in an Inheritance
Structure? 445
Implementing and Querying with User-Defined Functions (UDFs) 445
Summary 447

17. Using EntityObjects in WCF Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449


Planning for an Entity Framework–Agnostic Client 450
Assessing the Pros and Cons of an Entity Framework–Agnostic
Consumer 451
Building a Simple WCF Service with EntityObjects 452
Creating the Service 453
Defining the Service Operations 454
Defining Extra Service Classes 455
Exposing Custom Properties 456
Implementing the Service Interface 457
Adding Graphs to ObjectContext 460
Deleting Objects 461
Updating the Object Graph 463
Client Rules for Identifying Changes in an EntityCollection 463
The UpdateCustomer Method 463
Handling New and Existing Reservations 465
Deleting Reservations 466
Building a Simple Console App to Consume an EntityObject Service 467
Enabling the Client Application to Receive Large Messages
from the Service 468
Creating Methods to Test the Service Operations 469
Analyzing the GetAndUpdateCustomer Method 473
Testing Out the Other Service Operations 474
Creating WCF Data Services with Entities 474
Putting WCF Data Services in Perspective 475
Creating a WCF Data Service 475
Filtering at the Service Level Using QueryInterceptor 480
Anticipating Exceptions 481
Exposing Related Data Through the Service 481
Preparing for WCF Data Services’ Limitations 483
Modifying Data Through a Service 484
Learning More About Creating and Consuming WCF Data Services 485

Table of Contents | xiii


Understanding How WCF RIA Services Relates to the Entity Framework 485
Summary 487

18. Using POCOs and Self-Tracking Entities in WCF Services . . . . . . . . . . . . . . . . . . . . . . 489


Creating WCF-Friendly POCO Classes 490
Updating the POCO Classes Based on the Current BreakAway Model 490
Isolating the POCO Entities in Their Own Project 491
Adding Custom Logic to the POCO Entities with a Base Class 493
Following WCF Collection Rules 495
Preventing Properties from Being Marked As Virtual 496
Building a WCF Service That Uses POCO Classes 497
Implementing the Interface 498
Using the Service 500
Using the Self-Tracking Entities Template for WCF Services 503
Creating and Exploring the Self-Tracking Entities 503
Putting the Change-Tracking Logic Where It’s Needed 505
Creating a WCF Service That Uses Self-Tracking Entities 506
Watching Self-Tracking Entities Under the Covers 507
Inspecting the Generated Context Class and Extensions 513
Using POCO Entities with WCF Data and RIA Services 515
Preparing for WCF Data Services 515
Using POCO Entities in WCF RIA Services 517
Sorting Out the Many Options for Creating Services 519
Summary 520

19. Working with Relationships and Associations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521


Deconstructing Relationships in the Entity Data Model 522
Understanding How the Entity Data Model Wizard Creates
the Association 523
Understanding Additional Relationship Items 525
Handling Nonessential Navigation Properties 526
Understanding the Major Differences Between Foreign Key Associations
and Independent Associations 527
Defining Associations in Metadata 528
Detecting Associations at Runtime 528
Deconstructing Relationships Between Instantiated Entities 529
Understanding Relationship Manager and the IRelatedEnd Interface 530
Late-Binding Relationships 530
Taking a Peek Under the Covers: How Entity Framework
Manages Relationships 531
Understanding Navigation Properties 534
Understanding Referential Integrity and Constraints 537
Implementing Deletes and Cascading Deletes 540

xiv | Table of Contents


Defining Relationships Between Entities 542
The CLR Way: Setting a Navigation Property to an Entity 543
Setting a Foreign Key Property 544
Setting an EntityReference Using an EntityKey 544
Loading, Adding, and Attaching Navigation Properties 545
Lazy Loading 545
EntityReference.Load and EntityCollection.Load 547
Loading from Detached Entities: Lazy and Explicit 547
Using EntityCollection.Add 548
Using Attach and Remove 549
Moving an Entity to a New Graph 550
Learning a Few Last Tricks to Make You a Relationship Pro 551
Using CreateSourceQuery to Enhance Deferred Loading 551
Getting a Foreign Key Value in an Independent Association 552
Summary 553

20. Real World Apps: Connections, Transactions, Performance, and More . . . . . . . . . . 555
Entity Framework and Connections 555
Overriding EntityConnection Defaults 556
Working with Connection Strings Programmatically 557
Opening and Closing Connections 560
Getting the Store Connection from EntityConnection 562
Disposing Connections 562
Pooling Connections 563
Fine-Tuning Transactions 564
Why Use Your Own Transaction? 564
Understanding Implicit Entity Framework Transactions 565
Specifying Your Own Read/Write Transactions 566
Specifying Your Own Read-Only Transactions 569
Rolling Back Transactions 570
Understanding Security 571
Guarding Against SQL Injection 571
Guarding Against Connection Piggybacks 573
Fine-Tuning Performance 574
Measuring Query Performance 575
Measuring Startup Performance 579
Reducing the Cost of Query Compilation 580
Caching for Entity SQL Queries 580
Precompiling Views for Performance 582
Precompiling LINQ to Entities Queries for Performance 585
Fine-Tuning Updates for Performance? 589
Lacking Support for Full Text Searches 590
Exploiting Multithreaded Applications 591

Table of Contents | xv
Forcing an ObjectContext to Use Its Own Thread 591
Implementing Concurrent Thread Processing 593
Exploiting .NET 4 Parallel Computing 596
Summary 596

21. Manipulating Entities with ObjectStateManager and MetadataWorkspace . . . . . 597


Manipulating Entities and Their State with ObjectStateManager 598
Refreshing Your High-Level Understanding of ObjectStateEntry 599
Getting an ObjectStateManager and Its Entries 599
Building Extension Methods to Overload GetObjectStateEntries 600
Building a Method to Return Managed Entities 602
Using GetObjectStateEntry and TryGetObjectStateEntry 603
Mining Entity Details from ObjectStateEntry 604
Leveraging the ObjectStateManager During Saves 609
Using ObjectStateManager to Build an EntityState Visualizer 611
Retrieving an ObjectStateEntry Using an EntityKey 612
Reading the OriginalValues and CurrentValues of an
ObjectStateEntry 613
Determining Whether a Property Has Been Modified 614
Displaying the State and Entity Type 614
Getting ComplexType Properties Out of ObjectStateEntry 615
Modifying Values with ObjectStateManager 619
Working with Relationships in ObjectStateManager 620
Using the MetadataWorkspace 622
Loading the MetadataWorkspace 622
Clearing the MetadataWorkspace from Memory 623
Understanding the MetadataWorkspace ItemCollections 624
Retrieving Metadata from the MetadataWorkspace 625
Querying the Metadata with LINQ to Objects 628
Building Dynamic Queries and Reading Results 629
Building Entity SQL Queries Dynamically Using Metadata 629
Creating Queries on the Fly with CreateObjectSet and Query
Builder Methods 632
Reading the Results of a Dynamically Created Query 634
Creating and Manipulating Entities Dynamically 637
Creating EntityObjects Without Entity Classes 637
Creating Entities and Graphs Dynamically 640
Summary 643

22. Handling Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645


Preparing for Exceptions 645
Handling EntityConnectionString Exceptions 647

xvi | Table of Contents


Connection String Can’t Be Found or Is Improperly Configured:
System.ArgumentException 648
Metadata Files Cannot Be Found: System.Data.MetadataException 648
Handling Connection String Exceptions 649
Handling Query Compilation Exceptions 649
Invalid LINQ to Entities Query Expressions:
System.NotSupportedException 649
Invalid Entity SQL Query Expressions: EntitySqlException 650
EntityCommandCompilationException Thrown by the Store
Provider 652
Creating a Common Wrapper to Handle Query Execution Exceptions 652
Handling Exceptions Thrown During SaveChanges Command Execution 654
UpdateException: Thrown When Independent Association Mapping
Constraints Are Broken 654
UpdateException: Thrown by Broken Constraints in the Database 655
Relying on Entity Framework to Automatically Roll Back When an
UpdateException Occurs 656
Gleaning Details from UpdateException 656
Planning for Other Exceptions Related to the Entity Framework 657
Handling Concurrency Exceptions 658
Summary 658

23. Planning for Concurrency Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659


Understanding Database Concurrency Conflicts 660
Understanding Optimistic Concurrency Options in the Entity Frame-
work 660
Ignoring Concurrency Conflicts 661
Forcing the User’s Data to the Server (ClientWins) 661
Refreshing the User’s Data with Server Data (StoreWins) 661
Determining the Scope of Changes 662
Using rowversion (a.k.a. timestamp) for Concurrency Checks 662
Implementing Optimistic Concurrency with the Entity Framework 663
Flagging a Property for Concurrency Checking 664
How the Entity Framework Uses the ConcurrencyMode Property 665
Concurrency Checking Without a rowversion Field 666
Concurrency Checking on a Checksum in the Data Store 666
Concurrency Checks for EntityReference Navigation Properties 667
Concurrency Checks and Inherited Types 667
Concurrency Checks and Stored Procedures 668
Handling OptimisticConcurrencyExceptions 670
Using ObjectContext.Refresh 671
Using Refresh with ClientWins 671
Using Refresh with StoreWins 673

Table of Contents | xvii


Refreshing Collections of Entities 673
Refreshing Related Entities in a Graph 675
Rewinding and Starting Again, and Maybe Again After That 676
Reporting an Exception 678
Handling Concurrency Exceptions at a Lower Level 678
Handling Exceptions in a Granular Way Without User Intervention 678
Handling Multiple Conflicts 680
Handling Exceptions When Transactions Are Your Own 682
Summary 683

24. Building Persistent Ignorant, Testable Applications . . . . . . . . . . . . . . . . . . . . . . . . 685


Testing the BreakAway Application Components 686
Getting Started with Testing 687
Writing an Integration Test That Hits the Database 687
Inspecting a Failed Test 689
Writing a Unit Test That Focuses on Custom Logic 689
Creating Persistent Ignorant Entities 693
Planning the Project Structure 695
Starting with the Model and Its POCO Entities 697
Building an Interface to Represent a Context 698
Modifying the BAEntities ObjectContext Class to Implement
the New Interface 699
Creating the IEntityRepository Interface 702
Creating the Repository Classes 703
Testing GetReservationsForCustomer Against the Database 706
Creating a Fake Context 708
Creating a FakeObjectSet Class 710
Completing the Fake Context 712
Building Tests That Do Not Hit the Database 714
Adding Validation Logic to the POCO Class 714
Adding Validation Logic to the Context 716
Providing ManagedEntities in the FakeContext 716
Hiding the Context from the Lower Layers with Unit of Work 718
Testing UnitOfWork Against the Database 720
Enabling Eager Loading in IContext 721
Leveraging Precompiled Queries in Your Repositories 722
Using the New Infrastructure in Your Application 723
Adding a UI Layer That Calls the Repository 723
Application Architecture Benefits from Designing Testable Code 724
Considering Mocking Frameworks? 725
Summary 725

xviii | Table of Contents


Discovering Diverse Content Through
Random Scribd Documents
“Tell me about it,” said she.
“Well, there was the Colonel’s wife. God bless me, how I adored her. I
must have been just about Harry’s age, for I had only lately joined, and she
was a woman getting on for forty. Good thing, too, for me, as I say, for it
kept me out of mischief. They used to say she encouraged me, but I don’t
believe it. Every woman likes to know that she’s admired, eh? She doesn’t
snub a boy who takes her out in the garden, and picks his father’s roses for
her. But we mustn’t have Harry boring her with his attentions. That’ll never
do.”
It seemed to Mrs. Ames of singularly little consequence whether Harry
bored Millie Evans or not. She would much have preferred to be assured
that her husband did. But the subsequent conversation did not reassure her
as to that.
“Nice little woman, she is,” he said. “Thoroughly nice little woman, and
naturally enough, my dear, since she is your cousin, she likes being treated
in neighbourly fashion. We had a great talk after lunch to-day, and I’m sorry
for her, sorry for her. I think we ought to do all we can to make life pleasant
for her. Drop in to tea, or drop in to lunch, as I did to-day. A doctor’s wife,
you know. She told me that some days she scarcely set eyes on her husband,
and when she did, he could think of nothing but microbes. And there’s
really nobody in Riseborough, except you and me, with whom she feels—
dear me, what’s that French word—yes, with whom she feels in her proper
milieu. I should like us to be on such terms with her—you being her cousin
—that we could always telephone to say we were dropping in, and that she
would feel equally free to drop in. Dropping in, you know: that’s the real
thing; not to be obliged to wait till you are asked, or to accept weeks ahead,
as one has got to do for some formal dinner-party. I should like to feel that
we mightn’t be surprised to find her picking sweet-peas in the garden, and
that she wouldn’t be surprised to find you or me sitting under her mulberry-
tree, waiting for her to come in. After all, intimacy only begins when
formality ceases. Shall I give you some soda water?”
Mrs. Ames did not want soda-water: she wanted to think. Her husband
had completely expressed the attitude she meant to adopt, but her own
adoption of it had presupposed a certain contrition on his part with regard to
his unusual behaviour. But he gave her no time for thought, and proceeded
to propose just the same sort of thing as she (in her magnanimity) had
thought of suggesting.
“Dinner, now,” he said. “Up till last night we have always been a bit
formal about dinner here in Riseborough. If you asked General Snookes,
you asked Mrs. Snookes; if you asked Admiral Jones, you asked Lady
Jones. You led the way, my dear, about that, and what could have been
pleasanter than our little party last night? Let us repeat it: let us be less
formal. If you want to see Mr. Altham, ask him to come. Mrs. Altham, let us
say, wants to ask me: let her ask me. Or if you meet Dr. Evans in the street,
and he says it is lunch time, go and have lunch with him, without bothering
about me. I shall do very well at home. I’m told that in London it is quite a
constant practice to invite like that. And it seems to me very sensible.”
All this had seemed very sensible to Mrs. Ames, when she had thought
of it herself. It seemed a little more hazardous now. She was well aware that
this plan had caused a vast amount of talk in Riseborough, the knowledge
of which she had much enjoyed, since it was of the nature of subjects
commenting on the movements of their queen, without any danger to her of
dethronement. But she was not so sure that she enjoyed her husband’s
cordial endorsement of her innovation. Also, in his endorsement there was
some little insincerity. He had taken as instance the chance of his wishing to
dine without his wife at Mrs. Altham’s, and they both knew how
preposterous such a contingency would be. But did this only prepare the
way for a further solitary excursion to Mrs. Evans’? Had Mrs. Evans asked
him to dine there? She was immediately enlightened.
“Of course, we talked over your delightful dinner-party of last night,” he
said, “and agreed in the agreeableness of it. And she asked me to dine there,
en garçon, on Tuesday next. Of course, I said I must consult you first; you
might have asked other people here, or we might be dining out together. I
should not dream of upsetting any existing arrangement. I told her so: she
quite understood. But if there was nothing going on, I promised to dine
there en garçon.”
That phrase had evidently taken Major Ames’ fancy; there was a ring of
youth about it, and he repeated it with gusto. His wife, too, perfectly
understood the secret smack of the lips with which he said it: she knew
precisely how he felt. But she was wise enough to keep the consciousness
of it completely out of her reply.
“By all means,” she said; “we have no engagement for that night. And I
am thinking of proposing myself for a little visit to Mrs. Bertram next week,
Lyndhurst. I know she is at Overstrand now, and I think ten days on the east
coast would do me good.”
He assented with a cordiality that equalled hers.
“Very wise, I am sure, my dear,” he said. “I have thought this last day or
two that you looked a little run down.”
A sudden misgiving seized her at this, for she knew quite well she
neither looked nor felt the least run down.
“I thought perhaps you and Harry would take some little trip together
while I was away,” she said.
“Oh, never mind us, never mind us,” said he. “We’ll rub along, en
garçon, you know. I daresay some of our friends will take pity on us, and
ask us to drop in.”
This was not reassuring: nor would Mrs. Ames have been reassured if
she could have penetrated at that moment unseen into Mrs. Altham’s
drawing-room. She and her husband had gone straight from Mrs. Ames’
house that afternoon to call on Mrs. Evans, and had been told she was not at
home. But Mrs. Altham of the eagle-eye had seen through the opened front
door an immense bowl of sweet-peas on the hall table, and by it a straw hat
with a riband of regimental colours round it. Circumstantial evidence could
go no further, and now this indefatigable lady was looking out Major Ames
in an old army list.
“Ames, Lyndhurst Percy,” she triumphantly read out. “Born 1860, and I
daresay he is older than that, because if ever there was a man who wanted
to be thought younger than his years, that’s the one. So in any case, Henry,
he is over forty-seven. And there’s the front-door bell. It will be Mrs.
Brooks. She said she would drop in for a chat after dinner.”
There was plenty to chat about that evening.
CHAPTER V
Mrs. Ames might or might not have been run down when she left
Riseborough the following week, but nothing can be more certain than that
she was considerably braced up seven days after that. The delicious
freshness of winds off the North Sea, tempering the heat of brilliant summer
suns, may have had something to do with it, and she certainly had more
colour in her face than was usual with her, which was the legitimate effect
of the felicitous weather. There was more colour in her hair also, and
though that, no doubt, was a perfectly legitimate effect too, being produced
by purely natural means, as the label on the bottle stated, the sun and wind
were not accountable for this embellishment.
She had spent an afternoon in London—chiefly in Bond Street—on her
way here, and had gone to a couple of addresses which she had secretly
snipped out of the daily press. The expenditure of a couple of pounds,
which was already yielding her immense dividends in encouragement and
hope, had put her into possession of a bottle with a brush, a machine that,
when you turned a handle, quivered violently like a motor-car that is
prepared to start, and a small jar of opaque glass, which contained the
miraculous skin-food. With these was being wrought the desired marvels;
with these, as with a magician’s rod, she was conjuring, so she believed, the
remote enchantments of youth back to her.
After quite a few days change became evident, and daily that change
grew greater. As regards her hair, the cost, both of time and material, in this
miracle-working, was of the smallest possible account. Morning and
evening, after brushing it, she rubbed in a mere teaspoonful of a thin yellow
liquid, which, as the advertisement stated, was quite free from grease or
obnoxious smell, and did not stain the pillow. This was so simple that it
really required faith to embark upon the treatment, for from the time of
Hebrew prophets, mankind have found it easier to do “some great thing”
than merely to wash in the Jordan. But Mrs. Ames, luckily, had shown her
faith, and by the end of a week the marvellous lotion had shown its works.
Till now, though her hair could not be described as grey, there was a
considerable quantity of grey in it: now she examined it with an eye that
sought for instead of shutting itself to such blemish, and the reward of its
search was of the most meagre sort. There was really no grey left in it: it
might have been, as far as colour could be taken as a test of age, the hair of
a young woman. It was not very abundant in quantity, but the lotion had
held out no promises on that score; quality, not quantity, was the sum of its
beckoning. The application of the skin-food was more expensive: she had to
use more and it took longer. Nightly she poured a can of very hot water into
her basin, and with a towel over her head to concentrate the vapour, she
steamed her face over it for some twenty minutes. Emerging red and hot
and stifled, she wiped off the streams of moisture, and with finger-tips
dipped in this marvellous cream, tapped and dabbed at the less happy
regions between her eyebrows, outside her eyes, across her forehead, at the
corners of her mouth, and up and down her neck. Then came the use of the
palpitating machine; it whirred and buzzed over her, tickling very much.
For half-an-hour she would make a patient piano of her face, then gently
remove such of the skin-food as still stayed on the surface, and had not
gone within to do its nurturing work. Certainly this was a somewhat
laborious affair, but the results were highly prosperous. There was no doubt
that to a perfectly candid and even sceptical eye, a week’s treatment had
produced a change. The wrinkles were beginning to be softly erased: there
was a perceptible plumpness observable in the leaner places. Between the
bouts of tapping and dabbing she sipped the glass of milk which she
brought up to bed with her, as the deviser of the skin-food recommended.
She drank another such glass in the middle of the morning, and digested
them both perfectly.
As these external signs appeared and grew there went on within her an
accompanying and corresponding rejuvenation of spirit. She felt very well,
owing, no doubt, to the brisk air, the milk, the many hours spent out-of-
doors, and in consequence she began to feel much younger. An unwonted
activity and lightness pervaded her limbs: she took daily a walk of a couple
of hours without fatigue, and was the life and soul of the dinner-table,
whose other occupants were her hosts, Mrs. Bertram, a cold, grim woman
with a moustache, and her husband, milder, with whiskers. Their only
passion was for gardening, and they seldom left their grounds; thus Mrs.
Ames took her walks unaccompanied.
Miles of firm sands, when the tide was low, subtended the cliffs on
which Mr. Bertram’s house stood, and often Mrs. Ames preferred to walk
along the margin of the sea rather than pursue more inland routes, and to-
day, after her large and wholesome lunch (the physical stimulus of the east
coast, combined with this mental stimulus of her object in coming here,
gave her an appetite of dimensions unknown at Riseborough) she took a
maritime way. The tide was far out, and the lower sands, still shining and
firm from the retained moisture of its retreat, made uncommonly pleasant
walking. She had abandoned heeled footgear, and had bought at a shop in
the village, where everything inexpensive, from wooden spades to stamps
and sticking plaster was sold, a pair of canvas coverings technically known
as sand-shoes. They laced up with a piece of white tape, and were juvenile,
light, and easily removable. They, and the great sea, and the jetsam of
stranded seaweed, and the general sense of youth and freshness, made most
agreeable companions, and she felt, though neither Mr. nor Mrs. Bertram
was with her, charmingly accompanied. Her small, toadlike face expressed
a large degree of contentment, and piercing her pleasant surroundings as the
smell of syringa pierces through the odour of all other flowers, was the
sense of her brown hair and fast-fading wrinkles. That gave her an inward
happiness which flushed with pleasure and interest all she saw. In the lines
of pebbles left by the retreating tide was an orange-coloured cornelian,
which she picked up, and put in her pocket. She could have bought the
same, ready polished, for a shilling at the cheap and comprehensive shop,
but to find it herself gave her a pleasure not to be estimated at all in terms of
silver coinage. Further on there was an attractive-looking shell, which she
also picked up, and was about to give as a companion to the cornelian,
when a sudden scurry of claw-like legs about its aperture showed her that a
hermit-crab was domiciled within, and she dropped it with a little scream
and a sense of danger escaped both by her and the hermit-crab. There were
attractive pieces of seaweed, which reminded her of years when she
collected the finer sorts, and set them, with the aid of a pin, on cartridge-
paper, spreading out their delicate fronds and fern-like foliage. There were
creamy ripples of the quiet sea, long-winged gulls that hovered fishing;
above all there was the sense of her brown hair and smoothed face. She felt
years younger, and she felt she looked years younger, which was scarcely
less solid a satisfaction.
It pleased her, but not acutely or viciously, to think of Mrs. Altham’s
feelings when she made her rejuvenated appearance in Riseborough. It was
quite certain that Mrs. Altham would suspect that she had been “doing
something to herself,” and that Mrs. Altham would burst with envy and
curiosity to know what it was she had done. Although she felt very kindly
towards all the world, she did not deceive herself to such an extent as to
imagine that she would tell Mrs. Altham what she had done. Mrs. Altham
was ingenious and would like guessing. But that lady occupied her mind but
little. The main point was that in a week from now she would go home
again, and that Lyndhurst would find her young. She might or might not
have been right in fearing that Lyndhurst was becoming sentimentally
interested in Millie Evans, and she was quite willing to grant that her
grounds for that fear were of the slenderest. But all that might be dismissed
now. She herself, in a week from now, would have recaptured that more
youthful aspect which had been hers while he was still of loverlike
inclination towards her. What might be called regular good looks had
always been denied her, but she had once had her share of youth. To-day
she felt youthful still, and once again, she believed, looked as if she
belonged to the enchanted epoch. She had no intention of using this
recapture promiscuously: she scarcely desired general admiration: she only
desired that her husband should find her attractive.
For a little while, as she took her quick, short steps along these shining
sands, she felt herself grow bitter towards Millie Evans. A sort of superior
pity was mixed with the bitterness, for she told herself that poor Millie, if
she had tried to flirt with Lyndhurst, would speedily find herself flirting all
alone. Very likely Millie was guiltless in intention; she had only let her
pretty face produce an unchecked effect. Men were attracted by a pretty
face, but the owners of such faces ought to keep a curb on them, so to
speak. Their faces were not their faults, but rather their misfortunes. A
woman with a pretty face would be wise to make herself rather reserved, so
that her manner would chill anybody who was inclined.... But the whole
subject now was obsolete. If there had been any danger, there would not be
any more, and she did not blame Millie. She must ask Millie to dine with
them en famille, which was much nicer than en garçon, as soon as she got
back.
It might be gathered from this account of Mrs. Ames’ self-communings
that deep down in her nature their lay a strain of almost farcical
fatuousness. But she was not really fatuous, unless it is fatuous to have
preserved far out into the plains of middle-age some vision of the blue
mountains of youth. It is true that for years she had been satisfied to dwell
on these plains; now, her fear that her husband, so much younger than
herself, was turning his eyes to blue mountains that did not belong to him,
made her desire to get out of the plains and ascend her own blue mountains
again and wave to him from there, and encourage his advance. She felt
exceedingly well, and in consequence told herself that in mind, as well as
physical constitution, she was young still, while the effect of the bottles
which she used with such regularity made her believe that the outward signs
of age were erasible. She seemed to have been granted a new lease of life in
a tenement that it was easy to repair. Her whole nature felt itself to be
quickened and vivified.
She had gone far along the sands, and the tide was beginning to flow
again. All round her were great empty spaces, a shipless sea, a cloudless
sky, a beach with no living being in sight. A sudden unpremeditated impulse
seized her, and without delay she sat down on the shore, and took off her
shoes and stockings. Then, pulling up her skirts, she hastily ran down to the
edge of the water, across a little belt of pebbles that tickled and hurt her
soft-soled feet, and waded out into the liquid rims of the sea. She was
astonished and amazed at herself that the idea of paddling had ever come
into her head, and more amazed that she had had the temerity to put it into
execution. For the first minute or two the cold touch of the water on her
unaccustomed ankles and calves made her gasp a little, but for all the
strangeness of these sensations she felt that paddling, playing like a child in
the shallow waters, expressed the tone of her mind, just as the melody of a
song expresses the words to which it is set. If she had had a spade, she
would certainly have built a sand-castle and dug moats about it, and a smile
lit up her small face at the thought of purchasing one at the universal shop,
and furtively conveying it to these unfrequented beaches. And the smile
almost ended in a blush when she tried to imagine what Riseborough
society would say if it became known that their queen not only paddled in
the sea, but seriously contemplated buying a wooden spade in order to
conduct building operations on lonely shores.
The paddling, though quite pleasant, was not so joyous as the impulse to
paddle had been, and it was not long before she sat down again on the
beach and tried to get the sand out of the small, tight places between her
toes, and to dry her feet and plump little legs with a most exiguous
handkerchief. But even in the midst of these troublesome operations, her
mind still ran riot, and she planned to secrete about her person one of her
smaller bedroom towels when she went for her walk next day. And she felt
as if this act of paddling must have aided in the elimination of wrinkles. For
who except the really young could want to paddle? To find that she had the
impulse of the really young was even better than to cultivate, though with
success, the appropriate appearance. All the way home this effervescence of
spirit was hers, which, though it definitely sprang from the effects of the
lotion, the skin-food and the tonic air, produced in her an illusion that was
complete. She was certainly ascending her remote blue mountains again,
and through a clarified air she could look over the plains, and see how very
flat they had been. That must all be changed: there must be more variety
and gaiety introduced into her days. For years, as she saw now, her life had
been spent in small, joyless hospitalities, in keeping her place as accredited
leader of Riseborough’s socialities, in paying her share towards the
expenses of the house. They did not laugh much at home: there had seemed
nothing particular to laugh about, and certainly they did not paddle. She
was forming no plan for paddling there now, irrespective of the fact that a
muddy canal, which was the only water in the neighbourhood, did not
encourage the scheme, but there must be introduced into her life and
Lyndhurst’s more of the spirit that had to-day prompted her paddling.
Exactly what form it should take she did not clearly foresee, but when she
had recaptured the spirit as well as the appearance of youth, there was no
fear that it would find any difficulty in expressing itself suitably. All aglow,
especially as to her feet, which tingled pleasantly, she arrived at her host’s
house again. They were both at work in the garden: Mrs. Bertram was
killing slugs in the garden beds, Mr. Bertram worms on the lawn.
Major Ames proved himself during the next week to be a good
correspondent, if virtue in correspondents is to be measured by the
frequency of their communications. His letters were not long, but they were
cheerful, since the garden was coming on well in this delightful weather,
which he hoped embraced Cromer also, and since he had on two separate
occasions made a grand slam when playing Bridge at the club. He and
Harry were jogging along quite pleasantly, but there had been no gaieties to
take them out, except a tea-party with ices at Mrs. Brooks’. Unfortunately,
some disaster had befallen the ices: personally, he thought it was salt
instead of sugar, but Harry had been unwell afterwards, which suggested
sour cream. But his indisposition had been but short, though violent. He
himself had dropped in to dine en garçon with the Evans’, and the doctor
was very busy. Finally (this came at the end of every letter), as the place
was doing her so much good, why not stop for another week? He was sure
the Bertrams (poor things!) would be delighted if she would.
But that suggestion did not commend itself to Mrs. Ames. She had come
here for a definite purpose, and when on the morning before her departure
she looked very critically at herself in the glass, she felt that her purpose
had been accomplished. Her skin had not, so much she admitted, the
unruffled smoothness of a young woman’s, but she had not been a young
woman when she married. But search where she might in her hair, there was
no sign of greyness in it all, while the contents of the bottle were not yet
half used. But she would take back the more than moiety with her, since an
occasional application when the hair had resumed its usual colour was
recommended. It appeared to her that it undoubtedly had resumed its
original colour: the change, though slight (for grey had never been
conspicuous), was complete; she felt equipped for youth again. And
psychologically she felt equipped: every day since the first secret paddling
she had paddled again in secret, and from a crevice in a tumble of fallen
rock she daily extracted a small wooden spade, by aid of which, with many
glancings around for fear of possible observers, she dug in the sand, making
moats and ramparts. The “first fine careless rapture” of this, it must be
admitted, had evaporated: after one architectural afternoon she had dug not
because this elementary pursuit expressed what she felt, so much as because
it expressed what she desired to feel. After all, she did not propose to
rejuvenate herself to the extent of being nine or ten years old again....

The manner of her return to Riseborough demanded consideration: it


was not sufficient merely to look up in a railway guide the swiftest mode of
transit and adopt it, for this was not quite an ordinary entry, and it would
never do to take the edge off it by making a travel-soiled and dusty first
appearance. So she laid down a plan.
The bare facts about the trains were these. A train starting at a
convenient hour would bring her to London a short half-hour before another
convenient train from another and distant terminus started for Riseborough.
It was impossible to make certain of catching this, so she wrote to her
husband saying that she would in all probability get to Riseborough by a
later train that arrived there at eight. She begged him not to meet her at the
station, but to order dinner for half-past eight. It would be nice to be at
home again. Then came the plan. Clearly it would never do to burst on him
like that, to sit down opposite him at the dinner-table beneath the somewhat
searching electric light there, handicapped by the fatigues of a hot journey
only imperfectly repaired by a hasty toilet. She must arrive by the early
train, though not expected till the later. Thus she would secure a quiet two
hours for bathing, resting and dressing. If Lyndhurst did not expect her to
arrive till eight it was a practical certainty that he would be at the club till
that hour, and walk home in time to welcome her arrival. He would then
learn that she had already come and was dressing. She would be careful to
let him go downstairs first, and a minute later she would follow. He should
see....
So in order to catch this earlier train from town she left Cromer while
morning was yet dewy, and had the peculiar pleasure, on her arrival at
Riseborough, of seeing her husband, from the windows of her cab, passing
along the street to the club. She had a moment’s qualm that he would see
her initialled boxes on the top, but by grace of a punctual providence Mrs.
Brooks came out of her house at the moment, and the Major raised a gallant
hat and spoke a cheerful word to her. Certainly he looked very handsome
and distinguished, and Mrs. Ames felt a little tremor of anticipation in
thinking of the chapters of life that were to be re-read by them. She felt
confident also; it never entered her head to have any misgivings as to what
the last fortnight, which had contained so much for her, might have
contained for him.
Harry had gone back to Cambridge for the July term the day before, and
she found on her arrival that she had the house to herself. The afternoon had
turned a little chilly, and she enjoyed the invigoration of a hot bath, and a
subsequent hour’s rest on her sofa. Then it was time to dress, and though
the dinner was of the simplest conjugal character, she put on a dress she had
worn but some half-dozen of times before, but which on this one occasion it
was meet should descend from the pompous existence that was its destiny
for a year or two to come. It was of daring rose-colour, the most resplendent
possible, and never failed to create an impression. Indeed, she had, on one
of its infrequent appearances, heard Lyndhurst say to his neighbour in an
undertone, “Upon my soul, Amy looks very well to-night.” And Amy meant
to look very well again.
All happened as she had planned. Shortly after eight Lyndhurst tapped at
her door on his return from the club, but could not be admitted, and at half-
past, having heard him go downstairs, she followed him. He had not
dressed, according to their custom when they were alone.
Major Ames was writing a note when she entered, and only turned round
in his chair, not getting up.
“Glad to see you home, my dear,” he said. “Excuse me one moment. I
must just direct this.”
She kissed him and waited while he scrawled an address. Then he got up
and rang the bell.
“Just in time to catch the post,” he said. “By Jove! Amy, you’ve put on
the famous pink gown. I would have dressed if I had known. You’re tired
with your journey, I expect. It was a very hot day here, until a couple of
hours ago.”
He gave the note to the servant.
“And dinner’s ready, I think,” he said.
They sat down opposite each other at ends of the rather long table. There
were no flowers on it, for it had not occurred to him to get the garden to
welcome her home-coming, and the whole of her resplendency was visible
to him. He began eating his soup vigorously.
“Capital plan in summer to have dinner at half-past eight,” he said.
“Gives one most of the daylight and not so long an evening afterwards.
Excellent pea-soup, this. Fresh peas from my garden. The Evans’ dine at
eight-thirty. And how have you been, Amy?”
Some indefinable chill of misgiving, against which she struggled, had
laid cold fingers on her. Things were not going any longer as she had
planned them. He had noticed her gown, but he had noticed nothing else.
But then he had scarcely looked up since they had come into the dining-
room. But now he finished his soup, and she challenged his attention.
“I have been very well indeed,” she said. “Don’t I look it?”
He looked her straight in the face, saw all that had seemed almost a
miracle to her—the softened wrinkles, the recovered colour of her hair.
“Yes, I think you do,” he said. “You’ve got a bit tanned too, haven’t you,
with the sun?”
The cold fingers closed a little more tightly on her.
“Have I?” she said. “That is very likely. I was out-of-doors all day. I
used to take quite long walks every afternoon.”
He glanced at the menu-card.
“I hope you’ll like the dinner I ordered you,” he said. “Your cook and I
had a great talk over it this morning. ‘She’ll have been in the train all day,’ I
said, ‘and will feel a little tired. Appetite will want a bit of tempting, eh?’ So
we settled on a grilled sole, and a chicken and a macédoine of fruit. Hope
that suits you, Amy. So you used to take long walks, did you? Is the country
pretty round about? Bathing, too. Is it a good coast for bathing?”
Again he looked at her as he spoke, and for the moment her heart-beat
quickened, for it seemed that he could not but see the change in her. Then
his sole required dissection, and he looked at his plate again.
“I believe it is a good coast,” she said. “There were a quantity of
bathing-machines. I did not bathe.”
“No. Very wise, I am sure. One has to be careful about chills as one gets
on. I should have been anxious about you, Amy, if I had thought you would
be so rash as to bathe.”
Some instinct of protest prompted her.
“There would have been nothing to be anxious about,” she said. “I
seldom catch a chill. And I often paddled.”
He laid down his knife and fork and laughed.
“You paddled!” he asked. “Nonsense, nonsense!”
She had not meant to tell him, for her reasonable mind had informed her
all the time that this was a secret expression of the rejuvenation she was
conscious of. But it had slipped out, a thoughtless assertion of the
youthfulness she felt.
“I did indeed,” she said, “and I found it very bracing and invigorating.”
Then for a moment a certain bitterness welled up within her, born from
disappointment at his imperceptiveness.
“You see I never suffer from gout or rheumatism like you, Lyndhurst,”
she said. “I hope you have been quite free from them since I have been
away.”
But his amusement, though it had produced this spirit of rancour in her,
had not been in the least unkindly. It was legitimate to find entertainment in
the thought of a middle-aged woman gravely paddling, so long as he had no
idea that there was a most pathetic side to it. Of that he had no inkling: he
was unaware that this paddling was expressive of her feeling of recaptured
youth, just as he was unaware that she believed it to be expressed in her
face and hair. But this remark was distinctly of the nature of an attack: she
was retaliating for his laughter. He could not resist one further answer
which might both soothe and smart (like a patent ointment) before he
changed the subject.
“Well, my dear, I’m sure you are a wonderful woman for your years,” he
said. “By Jove! I shall be proud if I’m as active and healthy as you in ten
years’ time.”

Dinner was soon over after this, and she left him, as usual, to have his
cigarette and glass of port, and went into the drawing-room, and stood
looking on the last fading splendour of the sunset in the west. The
momentary bitterness in her mind had quite died down again: there was
nothing left but a vague, dull ache of flatness and disappointment. He had
noticed nothing of all that had caused her such tremulous and secret joy. He
had looked on her smoothed and softened face, and seen no difference
there, on her brown unfaded hair and found it unaltered. He had only seen
that she had put her best gown on, and she had almost wished that he had
not noticed that, since then she might have had the consolation of thinking
that he was ill. It was not, it must be premised, that she meant she would
find pleasure in his indisposition, only that an indisposition would have
explained his imperceptiveness, which she regretted more than she would
have regretted a slight headache for him.
For a few minutes she was incapable of more than blank and empty
contemplation of the utter failure of that from which she had expected so
much. Then, like the stars that even now were beginning to be lit in the
empty spaces of the sky, fresh points in the dreary situation claimed her
attention. Was he preoccupied with other matters, that he was blind to her?
His letters, it is true, had been uniformly cheerful and chatty, but a
preoccupied man can easily write a letter without betraying the
preoccupation that is only too evident in personal intercourse. If this was so,
what was the nature of his preoccupation? That was not a cheerful star:
there was a green light in it.... Another star claimed her attention. Was it
Lyndhurst who was blind, or herself who saw too much? She had no idea
till she came to look into the matter closely, how much grey hair was
mingled with the brown. Perhaps he had no idea either: its restoration,
therefore, would not be an affair of surprise and admiration. But the
wrinkles....
She faced round from the window as he entered, and made another call
on her courage and conviction. Though he saw so little, she, quickened
perhaps by the light of the green star, saw how good-looking he was. For
years she had scarcely noticed it. She put up her small face to him in a way
that suggested, though it did not exactly invite a kiss.
“It is so nice to be home again,” she said.
The suggestion that she meant to convey occurred to him, but, very
reasonably, he dismissed it as improbable. A promiscuous caress was a
thing long obsolete between them. Morning and evening he brushed her
cheek with the end of his moustaches.
“Well, then, we’re all pleased,” he said good-humouredly. “Shall I ring
for coffee, Amy?”
She was not discouraged.
“Do,” she said, “and when we have had coffee, will you fetch a shawl
for me, and we will stroll in the garden. You shall show me what new
flowers have come out.”
The intention of that was admirable, the actual proposal not so happy,
since a glimmering starlight through the fallen dusk would not conduce to a
perception of colour.
“We’ll stroll in the garden by all means,” he said, “if you think it will not
be risky for you. But as to flowers, my dear, it will be easier to appreciate
them when it is not dark.”
Again she put up her face towards him. This time he might, perhaps,
have taken the suggestion, but at the moment Parker entered with the
coffee.
“How foolish of me,” she said. “I forgot it was dark. But let us go out
anyhow, unless you were thinking of going round to the club.”
“Oh, time for that, time for that,” said he. “I expect you will be going to
bed early after your long journey. I may step round then, and see what’s
going on.”
Without conscious encouragement or welcome on her part, a suspicion
darted into her mind. She felt by some process, as inexplicable as that by
which certain people are aware of the presence of a cat in the room, that he
was going round to see Mrs. Evans.
“I suppose you have often gone round to the club in the evening since I
have been away,” she said.
“Yes, I have looked in now and again,” he said. “On other evenings I
have dropped in to see our friends. Lonely old bachelor, you know, and
Harry was not always very lively company. It’s a good thing that boy has
gone back to Cambridge, Amy. He was always mooning round after Mrs.
Evans.”
That was a fact: it had often been a slightly inconvenient one. Several
times the Major had “dropped in” to see Millie, and found his son already
there.
“But I thought you were rather pleased at that, Lyndhurst,” she said.
“You told me you considered it not a bad thing: that it would keep Harry out
of mischief.”
He finished his coffee rather hastily.
“Yes, within reason, within reason,” he said. “Well, if we are to stroll in
the garden, we had better go out. You wanted a shawl, didn’t you? Very
wise: where shall I find one?”
That diverted her again to her own personal efforts.
“There are several in the second tray of my wardrobe,” she said.
“Choose a nice one, Lyndhurst, something that won’t look hideous with my
pink silk.”
The smile, as you might almost say, of coquetry, which accompanied this
speech, faded completely as soon as he left the room, and her face assumed
that business-like aspect, which the softest and youngest faces wear, when
the object is to attract, instead of letting a mutual attraction exercise its
inevitable power. Even though Mrs. Ames’ object was the legitimate and
laudable desire to attract her own husband, it was strange how common her
respectable little countenance appeared. She had adorned herself to attract
admiration: coquetry and anxiety were pitifully mingled, even as you may
see them in haunts far less respectable than this detached villa, and on faces
from which Mrs. Ames would instantly have averted her own. She hoped he
would bring a certain white silk shawl: two nights ago she had worn it on
the verandah after dinner at Overstrand, and the reflected light from it, she
had noticed, as she stood beneath a light opposite a mirror in the hall, had
made her throat look especially soft and plump. She stood underneath the
light now waiting for his return.
Fortune was favourable: it was that shawl that he brought, and she turned
round for him to put it on her shoulders. Then she faced him again in the
remembered position, underneath the light, smiling.
“Now, I am ready, Lyndhurst,” she said.
He opened the French window for her, and stood to let her pass out.
Again she smiled at him, and waited for him to join her on the rather
narrow gravel path. There was actually room for two abreast on it, for, on
the evening of her dinner-party, Harry had walked here side by side with
Mrs. Evans. But there was only just room.
“You go first, Amy,” he said, “or shall I? We can scarcely walk abreast
here.”
But she took his arm.
“Nonsense, my dear,” she said. “There: is there not heaps of room?”
He felt vaguely uncomfortable. It was not only the necessity of putting
his feet down one strictly in front of the other that made him so.
“Anything the matter, my dear?” he asked.
The question was not cruel: it was scarcely even careless. He could
hardly be expected to guess, for his perceptions were not fine. Also he was
thinking about somebody else, and wondering how late it was. But even if
he had had complete knowledge of the situation about which he was
completely ignorant, he could not have dealt with it in a more peremptory
way. The dreary flatness to which she had been so impassive a prey directly
after dinner, the sense of complete failure enveloped her like impenetrable
fog. Out of that fog, she hooted, so to speak, like an undervitalized siren.
“I am only so glad to get back,” she said, pressing his arm a little. “I
hoped you were glad, too, that I was back. Tell me what you have been
doing all the time I have been away.”
This, like banns, was for the third time of asking. He recalled for her the
days one by one, leaving out certain parts of them. Even at the moment, he
was astonished to find how vivid his recollection of them was. On
Thursday, when he had played golf in the morning, he had lunched with the
Evans’ (this he stated, for Harry had lunched there too) and he had culled
probably the last dish of asparagus in the afternoon. He had dined alone
with Harry that night, and Harry had toothache. Next day, consequently,
Harry went to the dentist in the morning, and he himself had played golf in
the afternoon. That he remembered because he had gone to tea with Mrs.
Evans afterwards, but that he did not mention, for he had been alone with
her, and they had talked about being misunderstood and about affinities. On
Saturday Harry had gone back to Cambridge, but, having missed his train,
he had made a second start after lunch. He had met Dr. Evans in the street
that day, going up to the golf links, and since he would otherwise be quite
alone in the evening, he had dined with them, “en garçon.”
This catalogue of trivial happenings took quite a long time in the
recitation. But below the trivialities there was a lurking significance. He
was not really in love with Millie Evans, and his assurance to himself on
that point was perfectly honest. But (this he did not put so distinctly to
himself) he thought that she was tremendously attracted by him. Here was
an appeal to a sort of deplorable sense of gallantry—so terrible a word only
can describe his terrible mind—and mentally he called her “poor little
lady.” She was pretty, too, and not very happy. It seemed to be incumbent
on him to interest and amuse her. His “droppings in” amused her: when he
got ready to drop out again, she always asked when he would come to see
her next. These “droppings in” were clearly bright spots to her in a drab
day. They were also bright spots to him, for he was more interested in them
than in all his sweet-peas. There was a “situation” come into his life,
something clandestine. It would never do, for instance, to let Amy or the
estimable doctor get a hint of it. Probably they would misunderstand it, and
imagine there was something to conceal. He had the secret joys of a
bloodless intrigue. But, considering its absolute bloodlessness, he was
amazingly wrapped up in it. It was no wonder that he did not notice the
restored colour of Amy’s hair.
He, or rather Mrs. Evans, had made a conditional appointment for to-
night. If possible, the possibility depending on Amy’s fatigue, he was going
to drop in for a chat. Primarily the chat was to be concerned with the
lighting of the garden by means of Chinese lanterns, for a nocturnal fête
that Mrs. Evans meant to give on her birthday. The whole garden was to be
lit, and since the entertainment of an illuminated garden, with hot soup,
quails and ices, under the mulberry-tree was obviously new to Riseborough,
it would be sufficiently amusing to the guests to walk about the garden till
supper-time. But there would be supererogatory diversions beyond that,
bridge-tables in the verandah, a small band at the end of the garden to
intervene its strains between the guests and the shrieks of South-Eastern
expresses, and already there was an idea of fancy dress. Major Ames
favoured the idea of fancy dress, for he had a red velvet garment, sartorially
known as a Venetian cloak, locked away upstairs, which was a dazzling
affair if white tights peeped out from below it. He knew he had a leg, and
only lamented the scanty opportunities of convincing others of the fact. But
the lighting of the garden had to be planned first: there was no use in having
a leg in a garden, if the garden was not properly lit. But the whole affair was
as yet a pledged secret: he could not, as a man of honour, tell Amy about it.
Short notice for a fête of this sort was of no consequence, for it was to be a
post-prandial entertainment, and the only post-prandial entertainment at
present existent in Riseborough was going to bed. Thus everybody would
be able to be happy to accept.
A rapid résumé of this made an undercurrent in his mind, as he went
through, in speaking voice, the history of the last days. Up and down the
narrow path they passed, she still with her hand in his arm, questioning,
showing an inconceivable interest in the passage of the days from which he
had left out all real points of interest. His patience came to an end before
hers.
“Upon my word, my dear,” he said, “it’s getting a little chilly. Shall we
go in, do you think? I’m sure you are tired with your journey.”
There was nothing more coming: she knew that. But even in the midst of
her disappointment, she found consolation. Daylight would show the re-
establishment of her youthfulness more clearly than electric light had done.
Every one looked about the same by electric light. And though, in some
secret manner, she distrusted his visit to the club, she knew how impolitic it
would be to hint, however remotely, at such distrust. It was much better this
evening to acquiesce in the imputation of fatigue. Nor was the imputation
groundless; for failure fatigues any one when under the same conditions
success would only stimulate. And in the consciousness of that, her
bitterness rose once more to her lips.
“You mustn’t catch cold,” she said. “Let us go in.”
It was still only half-past ten: all this flatness and failure had lasted but a
couple of hours, and Major Ames, as soon as his wife had gone upstairs, let
himself out of the house. His way lay past the doors of the club, but he did
not enter, merely observing through its lit windows that there were a good
many men in the smoking-room. On arrival at the Doctor’s he found that
Elsie and her father were playing chess in the drawing-room, and that Mrs.
Evans was out in the garden. He chose to go straight into the garden, and
found her sitting under the mulberry, dressed in white, and looking rather
like the Milky Way. She did not get up, but held out her hand to him.
“That is nice of you,” she said. “How is Cousin Amy?”
“Amy is very well,” said he. “But she’s gone to bed early, a little tired
with the journey. And how is Cousin Amy’s cousin?”
He sat down on the basket chair close beside her which creaked with his
weight.
“I must have a special chair made for you,” she said. “You are so big and
strong. Have you seen Cousin Amy’s cousin’s husband?”
“No: I heard you were out here. So I came straight out.”
She got up.
“I think it will be better, then, if we go in, and tell him you are here,” she
said. “He might think it strange.”
Major Ames jumped up with alacrity: with his alacrity was mingled a
pleasing sense of adventure.
“By all means,” he said. “Then we can come out again.”
She smiled at him.
“Surely. He is playing chess with Elsie. I do not suppose he will interrupt
his game.”

Apparently Dr. Evans did not think anything in the least strange. On the
whole, this was not to be wondered at, since he knew quite well that Major
Ames was coming to talk over garden illumination with his wife.
“Good evening, Major,” he said; “kind of you to come. You and my little
woman are going to make a pauper of me, I’m told. There, Elsie, what do
you say to my putting my knight there? Check.”
“Pig!” said Elsie.
“Then shall we go out, Major Ames?” said Millie. “Are you coming out,
Wilfred?”
“No, little woman. I’m going to defeat your daughter indoors. Come and
have a glass of whisky and soda with me before you go, Major.”
They went out again accordingly into the cool starlight.
“Wilfred is so fond of chess,” she said. “He plays every night with Elsie,
when he is at home. Of course, he is often out.”
This produced exactly the effect that she meant. She did not comment or
complain: she merely made a statement which arose naturally from what
was going on in the drawing-room.
But Major Ames drew the inference that he was expected to draw.
“Glad I could come round,” he said. “Now for the lanterns. We must
have them all down the garden wall, and not too far apart, either. Six feet
apart, eh? Now I’ll step the wall and we can calculate how many we shall
want there. I think I step a full yard still. Not cramped in the joints yet.”

It took some half hour to settle the whole scheme of lighting, which,
since Major Ames was not going to pay for it, he recommended being done
in a somewhat lavish manner. With so large a number of lanterns, it would
be easily possible to see his leg, and he was strong on the subject of fancy
dress.
“There’ll be some queer turn-outs, I shouldn’t wonder,” he said; “but I
expect there will be some creditable costumes too. By Jove! it will be quite
the event of the year. Amy and I, with our little dinners, will have to take a
back seat, as they say.”
“I hope Cousin Amy won’t think it forward of me,” said Millie.
Major Ames said that which is written “Pshaw.” “Forward?” he cried.
“Why, you are bringing a bit of life among us. Upon my word, we wanted
rousing up a bit. Why, you are a public benefactor.”
They had sat down to rest again after their labour of stepping out the
brick walls under the mulberry-tree, where the grass was dry, and only a
faint shimmer of starlight came through the leaves. At the bottom of the
garden a train shrieked by, and the noise died away in decrescent thunder.
She leaned forward a little towards him, putting up her face much as Amy
had done.
“Ah, if only I thought I was making things a little pleasant,” she said.
Suddenly it struck Major Ames that he was expected to kiss her. He
leaned forward, too.
“I think you know that,” he said. “I wish I could thank you for it.”
She did not move, but in the dusk he could see she was smiling at him. It
looked as if she was waiting. He made an awkward forward movement and
kissed her.
There was silence a moment: she neither responded to him nor repelled
him.
“I suppose people would say I ought not to have let you,” she said. “But
there is no harm, is there? After all, you are a—a sort of cousin. And you
have been so kind about the lanterns.”
Major Ames was thinking almost entirely about himself, hardly at all
about her. An adventure, an intrigue had begun. He had kissed somebody
else’s wife and felt the devil of a fellow. But with the wine of this emotion
was mingled a touch of alarm. It would be wise to call a halt, take his
whisky and soda with her husband, and get home to Amy.
CHAPTER VI
Mrs. Altham waited with considerable impatience next day for the
return of her husband from the club, where he went on most afternoons, to
sit in an arm-chair from tea-time to dinner and casually to learn what had
happened while he had been playing golf. She had been to call on Mrs.
Ames in the afternoon, and in consequence had matter of considerable
importance to communicate. She could have supported that retarded spate
of information, though she wanted to burst as soon as possible, but she had
also a question to ask Henry on which a tremendous deal depended. At
length she heard the rattle of his deposited hat and stick in the hall, and she
went out to meet him.
“How late you are, Henry,” she said; “but you needn’t dress. Mrs.
Brooks, if she does come in afterwards, will excuse you. Dinner is ready:
let us come in at once. Now, you were at the club last night, after dinner.
You told me who was there; but I want to be quite sure.”
Mr. Altham closed his eyes for a moment as he sat down. It looked as if
he was saying a silent grace, but appearances were deceptive. He was only
thinking, for he knew his wife would not ask such a question unless
something depended on it, and he desired to be accurate.
Then he opened them again, and helped the soup with a name to each
spoonful.
“General Fortescue,” he said. “Young Morton. Mr. Taverner, Turner,
Young Turner.”
That was five spoonfuls—three for his wife, two for himself. He was not
very fond of soup.
“And you were there all the time between ten and eleven?” asked his
wife.
“Till half-past eleven.”
“And there was no one else?”
Mr. Altham looked up brightly.
“The club waiter,” he said, “and the page. The page has been dismissed
for stealing sugar. The sugar bill was preposterous. That was how we found
out. Did you mean to ask about that?”
“No, my dear. Nor do I want to know.”
At the moment the parlour-maid left the room, and she spoke in an eager
undertone.
“Mrs. Ames told me that Major Ames went up to the club last night,
when she went to bed at half-past ten,” she said. “You told me at breakfast
whom you found there, but I wanted to be sure. Call them Mr. and Mrs.
Smith and then we can go on talking.”
The parlour-maid came back into the room.
“Yes, Mr. Smith apparently went up to the club at half-past ten,” she
said. “But he can’t have gone to the club, for in that case you would have
seen him. It has occurred to me that he didn’t feel well, and went to the
doctor’s.”
“It seems possible,” said Mr. Altham, not without enthusiasm,
understanding that “doctor” meant “doctor,” and which doctor.
“We have all noticed how many visits he has been paying to—to Dr.
Jones,” said Mrs. Altham, “during the time Mrs. Smith was away. But to
pay another one on the very evening of her return looks as if—as if
something serious was the matter.”
“My dear, there’s nothing whatever to show that Major Ames went to the
doctor’s last night,” he said.
Mrs. Altham gave him an awful glance, for the parlour-maid was in the
room, and this thoughtless remark rendered all the diplomatic substitution
of another nomenclature entirely void and useless.
“Mrs. Smith, I should say,” added Mr. Altham in some confusion,
proceeding to make it all quite clear to Jane, in case she had any doubts
about it.
“Suggest to me any other reasonable theory as to where he was, then,”
said Mrs. Altham.
“I can’t suggest where he was, my dear,” said Mr. Altham, finding his
legal training supported him, “considering that there is no evidence of any
kind that bears upon the matter. But to know that a man was not in one
given place does not show with any positiveness that he was at any other
given place.”
“No doubt, then, he went shopping at half-past ten last night,” said Mrs.
Altham, with deep sarcasm. “There are so many shops open then. The High
Street is a perfect blaze of light.”
Mr. Altham could be sarcastic, too, though he seldom exercised this gift.
“It quite dazzles one,” he observed.
Mrs. Altham no doubt was vexed at her husband’s sceptical attitude, and
she punished him by refraining from discussing the point any further, and
from giving him the rest of her news. But this severity punished herself
also, for she was bursting to tell him. When Jane had finally withdrawn, the
internal pressure became irresistible.
“Mrs. Ames has done something to her hair, Henry,” she said; “and she
has done something to her face. I had a good mind to ask her what she had
used. I assure you there was not a grey hair left anywhere, and a fortnight
ago she was as grey as a coot!”
“Coots are bald, not grey,” remarked her husband.
“That is mere carping, Henry. She is brown now. Is this another fashion
she is going to set us at Riseborough? What does it all mean? Shall we all
have to plaster our faces with cold cream, and dye our hair blue?”
Mr. Altham was in a painfully literal mood this evening and could not
disentangle information from rhetoric.
“Has she dyed her hair blue?” he asked in a slightly awestricken voice.
“No, my dear: how can you be so stupid? And I told you just now she
was brown. But at her age! As if anybody cared what colour her hair was.
Her face, too! I don’t deny that the wrinkles are less marked, but who cares
whether she is wrinkled or not?”
These pleasant considerations were discontinued by the sound of the
postman’s tap on the front door, and since the postman took precedence of
everybody and everything, Mr. Altham hurried out to see what excitements
he had piloted into port. Unfortunately, there was nothing for him, but there
was a large, promising-looking envelope for his wife. It was stiff, too, and
looked like the receptacle of an invitation card.
“One for you, my dear,” he said.
Mrs. Altham tore it open, and gave a great gasp.
“You would not guess in a hundred tries,” she said.
“Then be so kind as to tell me,” remarked her husband.
Mrs. Altham read it out all in one breath without stops.
“Mrs. Evans at home Thursday July 20 10 p.m. Shakespeare Fancy
Dress well I never!”
For a while little the silence of stupefaction reigned. Then Mr. Altham
gave a great sigh.
“I have never been to a fancy dress ball,” he said. “I think I should feel
very queer and uncomfortable. What are we meant to do when we get there,
Julia? Just stand about and look at each other. It will seem very strange.
What would you recommend me to be? I suppose we ought to be a pair.”
Mrs. Altham, to do her justice, had not thought seriously about her
personal appearance for years. But, as she got up from the table, and
consciously faced the looking-glass over the chimney-piece, it is idle to
deny that she considered it now. She was not within ten years of Mrs.
Ames’ age, and it struck her, as she carefully regarded herself in a perfectly
honest glass, that even taking into full consideration all that Mrs. Ames had
been doing to her hair and her face, she herself still kept the proper measure
of their difference of years between them. But it was yet too early to
consider the question of her impersonation. There were other things
suggested by the contemplation of a fancy-dress ball to be considered first.
There was so much, in fact, that she hardly knew where to begin. So she
whisked everything up together, in the manner of a sea-pie, in which all that
is possibly edible is put in the oven and baked.
“There will be time enough to talk over that, my dear,” she said, “for if
Mrs. Evans thinks we are all going to lash out into no end of expense in
getting dresses for her party, she is wrong as far as I, for one, am concerned.
For that matter you can put on your oldest clothes, and I can borrow Jane’s
apron and cap, and we can go as Darby and Joan. Indeed, I do not know if I
shall go at all—though, of course, one wouldn’t like to hurt Mrs. Evans’
feelings by refusing. Do you know, Henry, I shouldn’t in the least wonder if
we have seen the last of Mrs. Ames and all her airs of superiority and
leadership. You may depend upon it that Mrs. Evans did not consult her
before she settled to give a fancy dress party. It is far more likely that she
and Major Ames contrived it all between them, while Mrs. Ames was away,
and settled what they should go as, and I daresay it will be Romeo and
Juliet. I should not be in the least surprised if Mrs. Ames did not go to the
party at all, but tried to get something up on her own account that very
night. It would be like her, I am sure. But whether she goes or not, it seems
to me that we have seen the last of her queening it over us all. If she does
not go, I should think she would be the only absentee, and if she does, she
goes as Mrs. Evans’ guest. All these years she has never thought of a fancy
dress party——”
Mrs. Altham broke off in the middle of her address, stung by the
splendour of a sudden thought.
“Or does all this staying away on her part,” she said, “and dyeing her
hair, and painting her face, mean that she knew about it all along, and was
going to be the show-figure of it all? I should not wonder if that was it. As
likely as not, she and Major Ames will come as Hamlet and Ophelia, or
something equally ridiculous, though I am sure as far as the ‘too too solid
flesh’ goes, Major Ames would make an admirable Hamlet, for I never saw
a man put on weight in the manner he does, in spite of all the garden
rolling, which I expect the gardener does for him really. But whatever is the
truth of it all, and I’m sure every one is so secretive here in Riseborough
nowadays, that you never know how many dined at such a place on such a
night unless you actually go to the poulterer’s and find out whether one
chicken or two was sent,—what was I saying?”
She had been saying a good deal. Mr. Altham correctly guessed the train
of thought which she desired to recall.
“In spite of the secretiveness——” he suggested.
That served the purpose.
“No, my dear Henry,” said his wife rapidly, “I accuse no one of
secretiveness: if I did, you misunderstood me. All I meant was that when we
have settled what we are to go as, we will tell nobody. There is very little
sense in a fancy dress entertainment if you know exactly what you may
expect, and as soon as you see a Romeo can say for certain that it is Major
Ames, for instance; and I’m sure if he is to go as Romeo, it would be vastly
suitable if Mrs. Ames went as Juliet’s nurse.”
“I am not sure that I shall like so much finery,” said Mr. Altham, who
was thinking entirely about his own dress, and did not care two straws
about Major or Mrs. Ames. “It will seem very strange.”
“Nonsense, my dear; we will dine in our fancy dresses for an evening or
two before, and you will get quite used to it, whatever it is. Henry, do you
remember my white satin gown, which I scarcely wore a dozen times,
because it seemed too grand for Riseborough? It was too, I am sure: you
were quite right. It has been in camphor ever since. I used to wear my
Roman pearls with it. There are three rows, and the clasp is of real pearls.
The very thing for Cleopatra.”
“I recollect perfectly,” said Mr. Altham. His mind instantly darted off
again to the undoubted fact that whereas Major Ames was stout, he himself
was very thin. If he had been obliged to describe his figure at that moment,
he would have said it was boyish. The expense of a wig seemed of no
account.
“Well, my dear, white dress and pearls,” said his wife. “You are not very
encouraging. With that book of Egyptian antiquities, I can easily remodel
the dress. And I remember reading in a Roman history that Cleopatra was
well over thirty when Julius Cæsar was so devoted to her. And by the busts
he must have been much balder than you!”
It is no use denying that this was a rather heavy blow. Ever since the
mention of the word Cleopatra, he had seen himself complete, with a wig,
in another character.
“But Julius Cæsar was sixty,” he observed, with pardonable asperity. “I
do not see how I could make up as a man of sixty. And for that matter, my
dear, though I am sure no one would think you were within five years of
your actual age, I do not see how you could make up as a mere girl of thirty.
Why should we not go as ‘Antony and Cleopatra, ten years later’? It would
be better than to go as Julius Cæsar and Cleopatra ten years before!”
Mrs. Altham considered this. It was true that she would find it difficult to
look thirty, however many Roman pearls she wore.
“I do not know that it is such a bad idea of yours, Henry,” she said.
“Certainly there is no one in the world who cares about her age, or wants to
conceal it, less than I. And there is something original about your
suggestion—Antony and Cleopatra ten years later—Ah, there is the bell,
that will be Mrs. Brooks coming in. And there is the telephone also. Upon
my word, we never have a moment to ourselves. I should not wonder if half
Riseborough came to see us to-night. Will you go to the telephone and tell it
we are at home? And not a word to anybody, Henry, as to what we are
thinking of going as. There will be our surprise, at any rate, however much
other people go talking about their dresses. If you are being rung up to ask
about your costume, say that you haven’t given it a thought yet.”
For the next week Mrs. Altham was thoroughly in her element. She had
something to conceal, and was in a delicious state of tension with the
superficial desire to disclose her own impersonation, and the deep-rooted
satisfaction of not doing so. To complete her happiness, the famous white
satin still fitted her, and she was nearly insane with curiosity to know what
Major and Mrs. Ames “were going to be,” and what the whole history of the
projected festivity was. In various other respects her natural interest in the
affairs of other people was satiated. Mrs. Turner was to be Mistress Page,
which was very suitable, as she was elderly and stout, and did not really in
the least resemble Miss Ellen Terry. Mr. Turner had selected Falstaff, and
could be recognized anywhere. Young Morton, with unwonted modesty, had
chosen the part of the Apothecary in Romeo and Juliet. Mrs. Taverner was
to be Queen Catherine, and—almost more joyous than all—she had
persuaded Mrs. Brooks not to attempt to impersonate Cleopatra. What Mrs.
Brooks’ feelings would be when it dawned on her, as it not inconceivably
might, that Mrs. Altham had seen in her a striking likeness to her
conception of Hermione, because she did not want there to be two
Cleopatras, did not particularly concern her. She had asked Mrs. Brooks to
dinner the day after the entertainment, and her acceptance would bury the
hatchet, if indeed there was such a thing as a hatchet about. Finally, she had
called on Mrs. Evans, who had vaguely talked about Midsummer Night’s
Dream. Mrs. Altham had taken that to be equivalent to the fact that she
would appear as Titania, and Mrs. Evans had distinctly intended that she
should so take it. Indeed, the idea had occurred to her, but not very vividly.
Her husband was going to be Timon of Athens. That, again, was quite
satisfactory: nobody knew at all distinctly who Timon of Athens was, and
nobody knew much about Dr. Evans, except that he was usually sent for in
the middle of something. Probably the same thing happened to Timon of
Athens.
Indeed, within a couple of hours of the reception of Mrs. Evans’
invitations, which all arrived simultaneously by the local evening post, a
spirit of demoniacal gaiety, not less fierce than that which inspired Mrs.
Altham, possessed the whole of those invited. Though it was gay, it was
certainly demoniacal, for a quite prodigious amount of ill-feeling was
mingled with it which from time to time threatened to wreck the
proceedings altogether. For instance, only two days after all the invitations
had been accepted, Mrs. Evans had issued a further intimation that there
was to be dancing, and that the evening would open at a quarter past ten
precisely with a quadrille in which it was requested that everybody would
take part. It is easy to picture the private consternation that presided over
that evening; how in one house, Mrs. Brooks having pushed her central
drawing-room table to one side, all alone and humming to herself, stepped
in perplexed and forgotten measures, and how next door Mrs. and Mr.
Altham violently wrangled over the order of the figures, and hummed
different tunes, to show each other, or pranced in different directions. For
here was the bitter affair: these pains had to be suffered in loneliness, for it
was clearly impossible to confess that the practice of quadrilles was so long
past that the memory of them had vanished altogether. But luckily (though
at the moment the suggestion caused a great deal of asperity in Mrs.
Altham’s mind) Mrs. Ames came to the rescue with the suggestion that as
many of them, no doubt, had forgotten the precise manner of quadrilles, she
proposed to hold a class at half-past four to-morrow afternoon, when they
would all run through a quadrille together.
“There! I thought as much!” said Mrs. Altham. “That means that neither
Major nor Mrs. Ames can remember how the quadrille goes, and we,
forsooth, must go and teach them. And she puts it that she is going to teach
us! I am sure she will never teach me: I shall not go near the house. I do not
require to be taught quadrilles by anybody, still less by Mrs. Ames. There is
no answer,” she added to Jane.
Mr. Altham fidgeted in his chair. Last night he had been quite sure he
was right, in points where he and his wife differed, and that the particular
“setting partners” which they had shown each other so often did not come
in the quadrille at all, but occurred in lancers, just before the ladies’ chain.
But she had insisted that both the setting to partners and ladies’ chain came
in quadrilles. This morning, however, he did not feel quite so certain about
it.
“You might send a note to Mrs. Ames,” he observed, “and tell her you
are not coming.”
“No answer was asked for,” said his wife excitedly. “She just said there
was to be a quadrille practice at half-past four. Let there be. I am sure I have
no objection, though I do think you might have thought of doing it first,
Henry.”
“But she will like to know how many to expect,” said Henry. “If it is to
be at half-past four, she must be prepared for tea. It is equivalent to a tea-
party, unless you suppose that the class will be over before five.”
During the night Mrs. Altham had pondered her view about the ladies’
chain. It would be an awful thing if Henry happened to be right, and if, on
the evening of the dance itself, she presented her hand for the ladies’ chain,
and no chain of any sort followed. She decided on a magnanimous course.
“Upon my word, I am not sure that I shall not go,” she said, “just to see
what Mrs. Ames’ idea of a quadrille is. I should not wonder if she mixed it
up with something quite different, which would be laughable. And after all,
we ought not to be so unkind, and if poor Mrs. Ames feels she will get into
difficulties over the quadrille, I am sure I shall be happy to help her out. No
doubt she has summoned us like this, so that she need not show that she
feels she wants to be helped. We will go, Henry, and I daresay I shall get out
of her what she means to dress up as! But pray remember to say that we, at
any rate, have not given a thought to our costumes yet. And on our way, we
may as well call in at Mr. Roland’s, for if I am to wear my three rows of
pearls, he must get me a few more, since I find there is a good deal of string
showing. I daresay that ordinary pearl beads would answer the purpose
perfectly. I have no intention of buying more of the real Roman pearls.
They belonged to my mother, and I should not like to add to them. And if
you will insist on having some red stone in your cap, to make a buckle for
the feather, I am sure you could not do better than get a piece of what he
called German ruby that is in his shop now. I do not suppose anybody in
Riseborough could tell it from real, and after all this is over, I would wear it
as a pendant for my pearls. If you wish, I will pay half of it, and it is but a
couple of pounds altogether.”
It did not seem a really handsome offer, but Henry had the sense to
accept it. He wanted a stone to buckle the feather in a rather coquettish cap
that they had decided to be suitable for Mark Antony, and did not really care
what happened to it after he had worn it on this occasion, since it was
unlikely that another similar occasion would arise. Deep in his mind had
been an idea of turning it into a solitaire, but he knew he would not have the
practical courage of this daring conception. It would want another setting,
also.
In other houses there were no fewer anticipatory triumphs and past
perplexities. There was also, in some cases, wild and secret intrigue. For
instance, a few evenings after, Mrs. Brooks next door, sorting out garments
in her wardrobe from which she might devise a costume that should remind
the beholder of Hermione, looked from her bedroom window, where her
quest was in progress, and saw a strange sight in the next garden. There was
a lady in white satin with pearls; there was a gentleman in Roman toga with
a feathered cap. The Roman gentleman was a dubious figure; the lady
indubitable. If ever there was an elderly Cleopatra, this was she.
Mrs. Brooks sat heavily down, after observing this sight. It certainly was
Cleopatra in the next garden: as certainly it was a snake in the grass. In a
moment her mind was made up. She saw why she had been discouraged
from being Cleopatra; the false Mrs. Altham had wanted to be Cleopatra
herself, without rival. But she would be Cleopatra too. Riseborough should
judge between the effectiveness of the two representations. Of course, every
one knew that Mrs. Altham had three rows of Roman pearls, which were
nothing but some sort of vitreous enamel. But Mrs. Brooks, as Riseborough
also knew, had five or six rows of real seed-pearls. It was impossible to
denigrer seed-pearls: they were pearls, though small, and did not pretend to
be anything different to what they were. But the Roman prefix, to any fair-
minded person, invalidated the word “pearls.” Besides, even as Cleopatra
without pearls, she would have been willing to back herself against Mrs.
Altham. Cleopatra ought to be tall, which she was. Also Cleopatra ought to
be beautiful, which neither was. And Mrs. Altham had urged her to go as
Hermione! Of course, she had to revise her toilet, but luckily it had
progressed no further than the sewing of white rosettes on to a pair of
slightly worn satin shoes, which were equally suitable for any of
Shakespeare’s heroines.
The week which had passed for Mr. and Mrs. Altham in a succession of
so pleasing excitements and anxieties, had not been without incident to Mrs.
Ames. When (by the same post that bore their invitations to the other
guests) the announcement of the fancy dress ball reached her, and she read
it out to her husband (even as Mrs. Altham had done) towards the end of
dinner, he expressed his feelings with a good deal of pooh-ing and the
opinion that he, at any rate, was past the years of dressing-up. This attitude
(for it had been settled that the invitation was to come as a surprise to him)
he somewhat overdid, and found to his dismay that his wife quite agreed
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like