For the last few months I've been writing a book for Manning tentatively titled Dependency Injection in .NET. The page about the book is now live at the Manning web site where you can read more about it and, if you would like, purchase an Early Access edition and read the chapters as they are being written.

If you have ever wanted to learn about Dependency Injection (DI) related to .NET, here's your chance!

At the moment I'm about a third of the way into the book, so there's still some way to go, but I hope to be done with it in 2010.

If you decide to purchase an Early Access edition, I'd love to receive your feedback in the online forum.


Comments

Ohh, I could have used this book weeks ago! I've been trying to wrap my head around DI/IoC for some time, and in fact am working on a blog post on the subject. It seems complex on the surface, but is less so once you really get into it!

Purchased the MEAP, looking forward to the results!
2009-10-07 03:01 UTC
I hope that you get a lot out of it! If parts of the contents strike you as odd or you think that something is missing, please let me know. The Author Online forum is the preferred place, but you can drop me a line in any way you prefer.
2009-10-13 11:00 UTC
Bill Campbell
Hey Mark,

Got the MEAP of your book and am enjoying it. I was wondering if you are going to make any of the sample code from the book available? That would be awesome.

thanks,
Bill
2009-10-21 12:32 UTC
Yes, that is definitely the plan. Manning does have the code, but I don't know when they plan on making it available. It's still a little rough around the edges, but if you would like to get it now, send me an email (use the small envelope icon in the Contact section area) and I'll zip it up for you.
2009-10-21 12:55 UTC
Scott Peterson
Hello Mark,

While your book is now a couple of years old, I purchased an e-version of it and got a lot out of it. I saw immediate uses for interceptors in an application I am evaluating (for a re-write) at a new company, but I ran into some trouble.
In a copy of your ProductManagementClient code, in a MenuItem_Click event, I added code to purposefully throw an InvalidOperationException, one of the exception types listed in the ErrorHandlingInterceptor, just to see the interceptor in action. I then tried to step through the code, but I never got to the Interceptor; I always just see the standard Visual Studio exception dialog in Debug mode.
Am I approaching this incorrectly?

Thanks for all that you do for the .NET community; it has really been a big help to me.

Scott
2013-05-23 18:31 UTC

Scott, thanks for writing. The Visual Studio behaviour you describe fits my own experience: stepping into something Decorated with a dynamic interceptor doesn't really work. While I'm no expert in how the Visual Studio debugger works, I think it's because there's some auto-generated code (the dynamic interceptor(s)) between the call site and your code on the other side. Visual Studio doesn't have the source code for the dynamic interceptor, so it generally gives up when you try to do that.

However, if you set a breakpoint on the other side (behind the interceptors), you will still hit that breakpoint when you press F5. This should enable you to still 'see' the interceptor(s) in action, using the debugger. IIRC, you can also set breakpoints in your own interceptor code, and those should be hit as well.

As I wrote, I'm no expert in the Visual Studio debugger, but I do know that it has lots of options you can tweak. I wouldn't be surprised if there was an option that would enable you to skip over the interceptor code and into the code Decorated by the interceptor, but I don't know how to do that.

2013-05-23 19:07 UTC


Wish to comment?

You can add a comment to this post by sending me a pull request. Alternatively, you can discuss this post on Twitter or Google Plus, or somewhere else with a permalink. Ping me with the link, and I may add it as a comment.

Published

Monday, 05 October 2009 18:13:50 UTC

Tags



"Our team wholeheartedly endorses Mark. His expert service provides tremendous value."
Hire me!