Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Foreword

Preface

Acknowledgments

About this Book

1. Getting started with AOP

Chapter 1. Introducing AOP

1.1. What is AOP?

1.1.1. Features

1.1.2. Benefits

1.1.3. AOP in your daily life

1.2. Hello, World

1.3. Summary

Chapter 2. Acme Car Rental

2.1. Start a new project

2.1.1. Business requirements

2.1.2. Necessary nonfunctional requirements

2.2. Life without AOP

2.2.1. Write the business logic

2.2.2. Testing the business logic

2.2.3. Add logging

2.2.4. Introducing defensive programming

2.2.5. Working with transactions and retries

2.2.6. Handling exceptions

2.2.7. Refactor without AOP

2.3. The cost of change

2.3.1. Requirements will change

2.3.2. Small versus large projects

2.3.3. Signature changes

2.3.4. Working on a team

2.4. Refactor with AOP

2.4.1. Start simple and isolate the logging

2.4.2. Refactor defensive programming

2.4.3. Creating an aspect for transactions and retries

2.4.4. Put exception handling into its own class

2.5. Summary

2. The Fundamentals of AOP

Chapter 3. Call this instead: intercepting methods

3.1. Method interception

3.1.1. PostSharp method interception

3.1.2. Castle DynamicProxy method interception

3.2. Real-world example: data transactions

3.2.1. Ensuring data integrity with begin and commit

3.2.2. When transactions go bad: rollback

3.2.3. When all else fails, retry

3.3. Real-world example: threading

3.3.1. The basics of .NET threading

3.3.2. UI threads and worker threads

3.3.3. Declarative threading with AOP

3.4. Summary

Chapter 4. Before and after: boundary aspects

4.1. Boundary aspects

4.1.1. PostSharp method bounding

4.1.2. Method boundaries versus method interception

4.1.3. ASP.NET HttpModule bounding

4.2. Real-world example: detecting mobile users

4.2.1. Offer a link to an application

4.2.2. Don’t be a pest

4.3. Real-world example: caching

4.3.1. ASP.NET Cache

4.3.2. An application that could benefit from caching

4.3.3. Caching a result

4.3.4. Retrieving from the cache

4.3.5. A more robust cache key

4.4. Summary

Chapter 5. Get this instead: intercepting locations

5.1. Location interception

5.1.1. Fields and properties in .NET

5.1.2. PostSharp location interception

5.2. Real-world example: lazy loading

5.2.1. Lazy loading approaches in .NET

5.2.2. Implementing lazy loading with AOP

5.2.3. What about lazy-loading fields?

5.3. Real-world example: INotifyPropertyChanged

5.3.1. Using INotifyPropertyChanged in a desktop application

5.3.2. Problems and constraints with INotifyPropertyChanged

5.3.3. Reducing boilerplate with AOP

5.4. Summary

Chapter 6. Unit testing aspects

6.1. Writing tests with NUnit

6.1.1. Writing and running NUnit tests

6.1.2. Testing strategies for aspects

6.2. Castle DynamicProxy testing

6.2.1. Testing an interceptor

6.2.2. Injecting dependencies

6.3. PostSharp testing

6.3.1. Unit testing a PostSharp aspect

6.3.2. Injecting dependencies

6.3.3. Problems with PostSharp and testing

6.4. Summary

3. Advanced AOP concepts

Chapter 7. AOP implementation types

7.1. How does AOP work?

7.2. Runtime weaving

7.2.1. Proxy pattern revisited

7.2.2. Dynamic proxies

7.3. Compile-time weaving

7.3.1. Postcompiling

7.3.2. Before and after

7.4. Runtime versus compile-time weaving

7.4.1. Pros of runtime weaving

7.4.2. Pros of compile-time weaving

7.5. Summary

Chapter 8. Using AOP as an architectural tool

8.1. Compile-time initialization and validation

8.1.1. Initializing at compile time

8.1.2. Validating the correct use of an aspect

8.1.3. Real-world example: Threading revisited

8.2. Architectural constraints

8.2.1. Enforcing architecture

8.2.2. Real-world example: NHibernate and virtual

8.3. Multicasting

8.3.1. At the class level

8.3.2. At the assembly level

8.4. Summary

Chapter 9. Aspect composition: example and execution

9.1. Using multiple aspects

9.2. Aspect roles with PostSharp

9.2.1. PostSharp aspect roles

9.2.2. Role dependencies

9.3. Composing aspects with DynamicProxy

9.3.1. Ordering aspects

9.3.2. Reducing repetition with custom conventions

9.4. Real-world example: caching and authorization

9.4.1. Application architecture

9.4.2. PostSharp

9.4.3. Castle DynamicProxy

9.5. Summary

Appendix A. Ecosystem of .NET AOP tools

A.1. Compile-time AOP tools

A.1.1. PostSharp

A.1.2. LinFu

A.1.3. SheepAspect

A.1.4. Fody

A.1.5. CIL manipulation tools

A.2. Runtime AOP tools

A.2.1. Castle Windsor/DynamicProxy

A.2.2. StructureMap

A.2.3. Unity

A.2.4. Spring.NET

Appendix B. NuGet basics

B.1. Introduction to NuGet

B.1.1. Installing NuGet

B.1.2. Installing packages with NuGet UI

B.1.3. Install packages with Package Manager Console

B.2. NuGet package restore

B.2.1. Solution Explorer

B.2.2. Enabling package restore

B.2.3. What package restore does

Index

List of Figures

List of Tables

List of Listings

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset