| Introduction |
|
1 | (1) |
| From COM to .NET |
|
1 | (1) |
| Designing CSLA .NET |
|
2 | (1) |
| What's covered in this book? |
|
3 | (1) |
| What you need to use this book |
|
4 | (1) |
| Conventions |
|
5 | (1) |
| Customer support |
|
6 | (3) |
|
How to download sample code for this book |
|
|
6 | (1) |
|
|
|
6 | (1) |
|
|
|
6 | (1) |
|
|
|
7 | (2) |
| Chapter 1: Distributed architecture |
|
9 | (34) |
|
Logical and physical architecture |
|
|
10 | (14) |
|
|
|
11 | (1) |
|
Relationship between logical and physical models |
|
|
12 | (5) |
|
|
|
12 | (1) |
|
|
|
13 | (4) |
|
A 5-tier logical architecture |
|
|
17 | (3) |
|
|
|
17 | (1) |
|
|
|
18 | (1) |
|
|
|
18 | (1) |
|
|
|
19 | (1) |
|
Data storage and management |
|
|
20 | (1) |
|
Applying the logical architecture |
|
|
20 | (4) |
|
Optimal performance intelligent client |
|
|
21 | (1) |
|
High scalability intelligent client |
|
|
21 | (1) |
|
Optimal performance web client |
|
|
22 | (1) |
|
|
|
23 | (1) |
|
|
|
24 | (1) |
|
|
|
24 | (14) |
|
Potential business logic locations |
|
|
25 | (3) |
|
Business logic in the data management tier |
|
|
25 | (1) |
|
Business logic in the UI tier |
|
|
26 | (1) |
|
Business logic in the middle (business/data access) tier |
|
|
27 | (1) |
|
Business logic in a distributed business tier |
|
|
27 | (1) |
|
|
|
28 | (3) |
|
Business objects as smart data |
|
|
29 | (1) |
|
Anatomy of a business object |
|
|
30 | (1) |
|
|
|
31 | (13) |
|
A new logical architecture |
|
|
33 | (1) |
|
Local, anchored, and unanchored objects |
|
|
33 | (4) |
|
|
|
37 | (1) |
|
Architectures and frameworks |
|
|
38 | (1) |
|
|
|
39 | (4) |
| Chapter 2: Framework design |
|
43 | (60) |
|
|
|
44 | (23) |
|
|
|
47 | (2) |
|
Tracking broken business rules |
|
|
49 | (1) |
|
Tracking whether the object has changed |
|
|
50 | (1) |
|
Strongly-typed collections of child objects |
|
|
50 | (1) |
|
Simple and abstract model for the user interface developer |
|
|
51 | (5) |
|
|
|
52 | (1) |
|
|
|
53 | (2) |
|
|
|
55 | (1) |
|
|
|
56 | (3) |
|
Enabling our objects for data binding |
|
|
57 | (1) |
|
|
|
58 | (1) |
|
Object persistence and object-relational mapping |
|
|
59 | (7) |
|
Relational vs. object modeling |
|
|
60 | (1) |
|
Object-relational mapping |
|
|
61 | (1) |
|
|
|
62 | (2) |
|
Supporting physical n-tier models |
|
|
64 | (2) |
|
|
|
66 | (1) |
|
|
|
67 | (36) |
|
|
|
69 | (4) |
|
|
|
69 | (1) |
|
|
|
70 | (1) |
|
|
|
71 | (1) |
|
|
|
71 | (1) |
|
|
|
71 | (1) |
|
|
|
72 | (1) |
|
|
|
72 | (1) |
|
n-Level undo functionality |
|
|
73 | (3) |
|
|
|
74 | (1) |
|
|
|
75 | (1) |
|
|
|
76 | (3) |
|
|
|
77 | (1) |
|
|
|
78 | (1) |
|
|
|
78 | (1) |
|
|
|
79 | (2) |
|
|
|
80 | (1) |
|
|
|
80 | (1) |
|
|
|
80 | (1) |
|
|
|
81 | (14) |
|
The client-side DataPortal |
|
|
82 | (3) |
|
The server-side DataPortal |
|
|
85 | (3) |
|
|
|
88 | (7) |
|
|
|
95 | (2) |
|
Custom principal and identity objects |
|
|
95 | (1) |
|
|
|
95 | (1) |
|
Integration with our application |
|
|
96 | (1) |
|
|
|
97 | (1) |
|
|
|
98 | (2) |
|
|
|
100 | (3) |
| Chapter 3: Key technologies |
|
103 | (52) |
|
|
|
104 | (125) |
|
|
|
104 | (3) |
|
|
|
105 | (1) |
|
|
|
105 | (1) |
|
|
|
106 | (1) |
|
Object proxies and location transparency |
|
|
106 | (1) |
|
|
|
107 | (1) |
|
|
|
107 | (6) |
|
|
|
108 | (2) |
|
|
|
110 | (2) |
|
|
|
112 | (1) |
|
|
|
113 | (5) |
|
|
|
115 | (2) |
|
Using the binary formatter |
|
|
117 | (1) |
|
|
|
118 | (7) |
|
|
|
119 | (1) |
|
The Serializable() Attribute |
|
|
120 | (1) |
|
The NonSerialized() Attribute |
|
|
120 | (1) |
|
Serialization and Remoting |
|
|
121 | (3) |
|
Manually invoking serialization |
|
|
124 | (1) |
|
Enterprise Services (COM+) |
|
|
125 | (7) |
|
Enterprise Services and COM+ contexts |
|
|
126 | (1) |
|
Running code in Enterprise Services |
|
|
127 | (3) |
|
Using Enterprise Services directly |
|
|
127 | (1) |
|
Installing the assembly into COM+ |
|
|
128 | (1) |
|
Using Enterprise Services indirectly |
|
|
129 | (1) |
|
Two-phase distributed transactions |
|
|
130 | (2) |
|
|
|
132 | (4) |
|
|
|
132 | (4) |
|
|
|
132 | (1) |
|
Getting information from a Type object |
|
|
133 | (3) |
|
|
|
136 | (2) |
|
Creating custom attributes |
|
|
136 | (1) |
|
|
|
136 | (1) |
|
Restricting attribute usage |
|
|
137 | (1) |
|
Detecting custom attributes |
|
|
137 | (1) |
|
|
|
138 | (1) |
|
|
|
139 | (13) |
|
|
|
139 | (3) |
|
|
|
139 | (1) |
|
|
|
140 | (1) |
|
Data provider and DataSet interaction |
|
|
140 | (2) |
|
|
|
142 | (9) |
|
|
|
143 | (1) |
|
Reading data with a data reader |
|
|
144 | (5) |
|
|
|
149 | (2) |
|
|
|
151 | (1) |
|
|
|
152 | (3) |
| Chapter 4: Business framework implementation |
|
155 | (74) |
|
Setting up the CSLA NET solution |
|
|
157 | (1) |
|
|
|
157 | (7) |
|
|
|
159 | (1) |
|
Core. BindableCollection Base |
|
|
160 | (4) |
|
|
|
164 | (68) |
|
|
|
166 | (1) |
|
|
|
166 | (12) |
|
|
|
168 | (1) |
|
|
|
169 | (6) |
|
|
|
175 | (2) |
|
|
|
177 | (1) |
|
|
|
178 | (13) |
|
Tracking basic object status |
|
|
179 | (4) |
|
|
|
183 | (3) |
|
|
|
186 | (1) |
|
|
|
187 | (2) |
|
|
|
189 | (1) |
|
Edit level tracking for child objects |
|
|
190 | (1) |
|
|
|
191 | (10) |
|
|
|
193 | (2) |
|
|
|
195 | (3) |
|
|
|
198 | (2) |
|
Exposing BrokenRules from BusinessBase |
|
|
200 | (1) |
|
|
|
201 | (15) |
|
|
|
202 | (1) |
|
|
|
203 | (1) |
|
|
|
203 | (1) |
|
|
|
204 | (1) |
|
|
|
204 | (1) |
|
Reacting to insert, remove, or clear operations |
|
|
205 | (1) |
|
Deleted object collection |
|
|
206 | (1) |
|
Deleting and undeleting child objects |
|
|
207 | (4) |
|
|
|
211 | (1) |
|
|
|
212 | (1) |
|
|
|
213 | (1) |
|
BeginEdit, CancelEdit, and ApplyEdit |
|
|
214 | (1) |
|
|
|
215 | (1) |
|
|
|
216 | (1) |
|
|
|
217 | (2) |
|
|
|
217 | (1) |
|
|
|
218 | (1) |
|
|
|
219 | (6) |
|
|
|
220 | (1) |
|
|
|
221 | (2) |
|
|
|
223 | (1) |
|
|
|
224 | (1) |
|
|
|
224 | (1) |
|
|
|
225 | (1) |
|
|
|
225 | (4) |
| Chapter 5: Data access and security |
|
229 | (82) |
|
A note about object-oriented programming |
|
|
230 | (2) |
|
|
|
232 | (8) |
|
|
|
232 | (4) |
|
|
|
233 | (1) |
|
|
|
234 | (1) |
|
|
|
235 | (1) |
|
|
|
236 | (2) |
|
|
|
238 | (1) |
|
|
|
239 | (1) |
|
|
|
240 | (13) |
|
|
|
242 | (1) |
|
|
|
242 | (11) |
|
|
|
244 | (1) |
|
Creating the server-side DataPortal |
|
|
245 | (3) |
|
|
|
248 | (1) |
|
|
|
249 | (4) |
|
|
|
253 | (12) |
|
|
|
254 | (11) |
|
|
|
254 | (1) |
|
Creating the DataPortal class |
|
|
255 | (1) |
|
|
|
256 | (5) |
|
|
|
261 | (3) |
|
Updating the CSLA project |
|
|
264 | (1) |
|
CSLA.Server.ServicedDataPortal |
|
|
265 | (5) |
|
|
|
265 | (5) |
|
|
|
265 | (2) |
|
Creating the DataPortal class |
|
|
267 | (1) |
|
|
|
268 | (1) |
|
Updating the CSLA project |
|
|
269 | (1) |
|
|
|
270 | (8) |
|
Server-side DataPortal host |
|
|
271 | (7) |
|
Reference CSLA assemblies |
|
|
272 | (1) |
|
|
|
272 | (1) |
|
|
|
273 | (1) |
|
Registering ServicedDataPortal |
|
|
274 | (1) |
|
|
|
274 | (1) |
|
Making the DataPortal useful |
|
|
274 | (4) |
|
|
|
278 | (20) |
|
|
|
278 | (9) |
|
|
|
279 | (1) |
|
|
|
280 | (2) |
|
Adding a stored procedure |
|
|
282 | (1) |
|
Configuring database permissions |
|
|
283 | (1) |
|
Creating the database project |
|
|
284 | (2) |
|
|
|
286 | (1) |
|
|
|
287 | (6) |
|
Creating a business object |
|
|
288 | (4) |
|
|
|
292 | (1) |
|
|
|
293 | (1) |
|
|
|
293 | (5) |
|
|
|
294 | (1) |
|
|
|
294 | (4) |
|
|
|
298 | (10) |
|
|
|
298 | (3) |
|
Creating the SafeDataReader class |
|
|
299 | (2) |
|
|
|
301 | (11) |
|
|
|
303 | (5) |
|
|
|
308 | (3) |
| Chapter 6: Object-oriented application design |
|
311 | (38) |
|
|
|
312 | (4) |
|
|
|
313 | (3) |
|
|
|
314 | (1) |
|
|
|
314 | (1) |
|
|
|
315 | (1) |
|
|
|
315 | (1) |
|
|
|
316 | (11) |
|
|
|
316 | (2) |
|
|
|
318 | (12) |
|
|
|
319 | (1) |
|
|
|
319 | (1) |
|
Overly complex relationships |
|
|
319 | (5) |
|
Optimizing for performance |
|
|
324 | (1) |
|
|
|
325 | (2) |
|
|
|
327 | (3) |
|
|
|
330 | (19) |
|
|
|
331 | (1) |
|
|
|
331 | (3) |
|
|
|
332 | (1) |
|
|
|
332 | (1) |
|
|
|
333 | (1) |
|
|
|
333 | (1) |
|
|
|
334 | (2) |
|
|
|
336 | (6) |
|
|
|
337 | (1) |
|
|
|
337 | (1) |
|
|
|
338 | (1) |
|
|
|
338 | (1) |
|
|
|
338 | (1) |
|
|
|
339 | (1) |
|
|
|
339 | (1) |
|
|
|
340 | (1) |
|
|
|
340 | (1) |
|
|
|
341 | (1) |
|
|
|
341 | (1) |
|
|
|
342 | (1) |
|
|
|
342 | (1) |
|
Creating the database project |
|
|
342 | (4) |
|
|
|
344 | (2) |
|
|
|
346 | (3) |
| Chapter 7: Business object implementation |
|
349 | (96) |
|
Business object lifecycle |
|
|
349 | (13) |
|
|
|
350 | (4) |
|
|
|
350 | (1) |
|
|
|
351 | (3) |
|
|
|
354 | (2) |
|
|
|
354 | (1) |
|
|
|
355 | (1) |
|
Updating editable objects |
|
|
356 | (4) |
|
Adding and editing root objects |
|
|
357 | (1) |
|
Adding, editing, and deleting child objects |
|
|
358 | (1) |
|
|
|
359 | (1) |
|
Disposing and finalizing objects |
|
|
360 | (2) |
|
|
|
360 | (1) |
|
Implementing a Finalize method |
|
|
361 | (1) |
|
|
|
362 | (28) |
|
|
|
362 | (5) |
|
The Serializable attribute |
|
|
362 | (1) |
|
|
|
362 | (2) |
|
Private default constructor |
|
|
364 | (1) |
|
|
|
365 | (2) |
|
|
|
367 | (23) |
|
Editable root business objects |
|
|
368 | (4) |
|
Editable child business objects |
|
|
372 | (4) |
|
|
|
376 | (2) |
|
|
|
378 | (3) |
|
Editable child collection |
|
|
381 | (3) |
|
Read-only business objects |
|
|
384 | (2) |
|
Read-only collections of objects |
|
|
386 | (2) |
|
|
|
388 | (2) |
|
|
|
390 | (51) |
|
|
|
392 | (1) |
|
Business class implementation |
|
|
393 | (53) |
|
|
|
394 | (16) |
|
|
|
410 | (1) |
|
|
|
411 | (6) |
|
|
|
417 | (3) |
|
|
|
420 | (6) |
|
|
|
426 | (3) |
|
|
|
429 | (6) |
|
|
|
435 | (1) |
|
|
|
436 | (4) |
|
|
|
440 | (1) |
|
|
|
441 | (4) |
| Chapter 8: Windows Forms UI |
|
445 | (46) |
|
|
|
446 | (43) |
|
Application configuration |
|
|
447 | (4) |
|
Application configuration file |
|
|
447 | (2) |
|
Configuring the DataPortal server |
|
|
449 | (2) |
|
|
|
451 | (3) |
|
|
|
451 | (1) |
|
|
|
452 | (2) |
|
|
|
454 | (6) |
|
|
|
455 | (2) |
|
|
|
457 | (1) |
|
|
|
458 | (1) |
|
Using Windows' integrated security |
|
|
459 | (1) |
|
|
|
460 | (2) |
|
|
|
460 | (2) |
|
|
|
462 | (15) |
|
|
|
462 | (13) |
|
|
|
475 | (2) |
|
|
|
477 | (1) |
|
|
|
478 | (3) |
|
|
|
478 | (2) |
|
|
|
480 | (1) |
|
|
|
481 | (12) |
|
|
|
481 | (6) |
|
|
|
487 | (2) |
|
|
|
489 | (2) |
| Chapter 9: Web Forms UI |
|
491 | (64) |
|
Web development and objects |
|
|
491 | (2) |
|
|
|
493 | (6) |
|
|
|
494 | (2) |
|
Using a web farm in ASP.NET |
|
|
495 | (1) |
|
Transferring state to/from the client |
|
|
496 | (1) |
|
State in a file or database |
|
|
497 | (2) |
|
|
|
499 | (54) |
|
Application configuration |
|
|
500 | (3) |
|
|
|
501 | (1) |
|
Using a separate DataPortal server |
|
|
502 | (1) |
|
|
|
503 | (1) |
|
|
|
503 | (2) |
|
Login form and security configuration |
|
|
505 | (5) |
|
Changing the Web.config file |
|
|
505 | (1) |
|
|
|
506 | (3) |
|
|
|
509 | (1) |
|
|
|
510 | (8) |
|
|
|
511 | (3) |
|
|
|
514 | (4) |
|
|
|
518 | (11) |
|
|
|
518 | (3) |
|
|
|
521 | (8) |
|
|
|
529 | (5) |
|
|
|
530 | (1) |
|
|
|
530 | (4) |
|
|
|
534 | (4) |
|
|
|
534 | (2) |
|
|
|
536 | (2) |
|
|
|
538 | (2) |
|
|
|
540 | (10) |
|
|
|
541 | (3) |
|
|
|
544 | (6) |
|
|
|
550 | (3) |
|
|
|
553 | (2) |
| Chapter 10: Web services Interface |
|
555 | (38) |
|
|
|
556 | (3) |
|
|
|
556 | (1) |
|
Message-based communication |
|
|
557 | (1) |
|
|
|
557 | (1) |
|
SOAP, web services, and the NET Framework |
|
|
558 | (1) |
|
Web services as an interface |
|
|
559 | (4) |
|
A web service for every tier? |
|
|
560 | (1) |
|
A web service as the 'user interface' |
|
|
561 | (1) |
|
Web services and contracts |
|
|
562 | (1) |
|
Implementing a web services interface |
|
|
563 | (30) |
|
|
|
563 | (5) |
|
|
|
564 | (1) |
|
Grouping web methods into web services |
|
|
564 | (1) |
|
|
|
565 | (2) |
|
|
|
567 | (1) |
|
Web service implementation |
|
|
568 | (17) |
|
|
|
568 | (3) |
|
|
|
571 | (1) |
|
Handling security on the server |
|
|
572 | (4) |
|
|
|
576 | (2) |
|
|
|
578 | (2) |
|
|
|
580 | (2) |
|
|
|
582 | (1) |
|
|
|
583 | (1) |
|
|
|
584 | (1) |
|
Web service consumer implementation |
|
|
585 | (6) |
|
|
|
586 | (1) |
|
Handling security on the consumer |
|
|
587 | (3) |
|
|
|
590 | (1) |
|
|
|
591 | (2) |
| Chapter 11: Reporting and batch processing |
|
593 | (68) |
|
|
|
594 | (1) |
|
Dealing with distributed environments |
|
|
595 | (1) |
|
|
|
595 | (1) |
|
Providing background processing |
|
|
596 | (1) |
|
Dealing with object-oriented applications |
|
|
596 | (2) |
|
|
|
596 | (1) |
|
Batch processing and objects |
|
|
597 | (1) |
|
|
|
598 | (46) |
|
|
|
599 | (4) |
|
The role of the BatchQueueService object |
|
|
600 | (1) |
|
The role of the BatchEntry object |
|
|
601 | (1) |
|
The role of the BatchEntrylnfo object |
|
|
602 | (1) |
|
Security and user identities |
|
|
603 | (1) |
|
Creating the BatchQueue assembly |
|
|
603 | (37) |
|
|
|
604 | (1) |
|
|
|
605 | (2) |
|
|
|
607 | (1) |
|
Client-side BatchQueue class |
|
|
608 | (3) |
|
Server-side BatchQueue class |
|
|
611 | (2) |
|
|
|
613 | (3) |
|
|
|
616 | (2) |
|
|
|
618 | (22) |
|
Creating and running batch jobs |
|
|
640 | (4) |
|
|
|
640 | (2) |
|
|
|
642 | (2) |
|
Loading a DataSet from objects |
|
|
644 | (15) |
|
|
|
645 | (12) |
|
|
|
645 | (1) |
|
|
|
646 | (1) |
|
|
|
646 | (3) |
|
Automatic discovery of properties and fields |
|
|
649 | (4) |
|
Populating a DataTable from an (List |
|
|
653 | (2) |
|
Implementing the Fill methods |
|
|
655 | (2) |
|
Reporting using ObjectAdapter |
|
|
657 | (2) |
|
|
|
659 | (2) |
| Appendix A: NetRun |
|
661 | (22) |
|
|
|
661 | (4) |
|
|
|
662 | (1) |
|
Object serialization workaround |
|
|
663 | (1) |
|
Reading application configuration settings |
|
|
663 | (1) |
|
|
|
664 | (1) |
|
|
|
665 | (2) |
|
|
|
667 | (12) |
|
|
|
667 | (4) |
|
|
|
667 | (1) |
|
|
|
668 | (1) |
|
|
|
669 | (2) |
|
|
|
671 | (8) |
|
|
|
671 | (2) |
|
Serialization bug workaround |
|
|
673 | (1) |
|
|
|
674 | (3) |
|
Revoke FullTrust security |
|
|
677 | (2) |
|
|
|
679 | (1) |
|
|
|
679 | (1) |
|
|
|
680 | (3) |
| Indexes |
|
683 | |