Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Professional ASP.NET Design Patterns
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET Design Patterns
This is the forum to discuss the Wrox book Professional ASP.NET Design Patterns by Scott Millett; ISBN: 978-0-470-29278-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 27th, 2011, 02:03 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question on the Domain Events Framework

Scott,

I'd like to first say that this book has alone taken my development to a whole new level. FINALLY, someone has the time to explain IMPLEMENTATION from a .NET point of view instead of just blogging about DDD and providing no implementation... so thanks for writing a GREAT book.

I hope to see a 2nd version, or another book along the same lines as DDD and Enterprise Architecture become more widely adopted by the .NET community.

So, on to my question.

On pg. 617, you introduce a basic framework for handling Domain Events. You credit Udi Dahan with the framework, but I believe the implementation is your own.

The most recent info I can find on Udi's blog about this is here:
http://www.udidahan.com/2009/06/14/d...nts-salvation/

with, or course, no implementation on his end ;)

I tried extracting the framework from the final Agathas Storefront code download for Chapter 14 (the .NET 4.0 version), and brought it into a new project just to see if I could play with the framework a bit, and to see if this framework is something I could use on an existing project.

It seems the one thing that is not working for me is the Setter Injection in for the DomainEventHandlerFactory property in the DomainEvents class.

the Bootstrapper file looks like it correctly sets the dependency of that property to a concrete object:
Code:
ForRequestedType<IDomainEventHandlerFactory>().TheDefault.Is.OfConcreteType<StructureMapDomainEventHandlerFactory>();
when I hit code that calls the .RaiseEvents method of the static DomainEvents class, the DomainEventHanlderFactory is always null.

For example, in my test project, I have a OrderService class that has a Create method that takes an Order:
Code:
public void Create(Order order)
{
    DomainEvents.Raise(new OrderSubmittedEvent() { Order = order });
}
this should look very familiar, as it's pretty much a call I took from Agatha's.

I can see what StructureMap has by calling "ObjectFactory.WhatDoIHave()", and it has an instance of StructureMapDomainEventHandlerFactory for IDomainEventHandlerFactory definition.

But again, even with StructureMap telling me it has an implementation for the DomainEvents.DomainEventHandlerFactory, when I go to call Raise in the DomainEvents class, DomainEventHandlerFactory is null.

If i add an explicit assignment in the OrderService class to DomainEventHandlerFactory like this:
Code:
public void Create(Order order)
{
    DomainEvents.DomainEventHandlerFactory = new StructureMapDomainEventHandlerFactory();
    DomainEvents.Raise(new OrderSubmittedEvent() { Order = order });
}
everything works, which means my problem is directly related to how StructureMap is working with the Setter Injection of DomainEventHandlerFactory in the DomainEvents static class.

Now, I'm working with StructureMap 2.6.x, and I know the book must have been written with the StructureMap 2.5.x version, but I don't think that should make a difference.

Any tips/pointers about what I could potentially be missing here?

Thanks so much!,
Mike
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Apache Server - Domain question? bamdesign BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 1 July 8th, 2010 12:55 AM
Same pages for sub domain from main domain vivek_inos ASP.NET 1.0 and 1.1 Professional 1 February 13th, 2007 10:15 AM
Events in User Controls question Aaron Edwards ASP.NET 1.0 and 1.1 Basics 1 December 6th, 2005 02:59 PM
VS.net Question : Protected with Events shahchi1 VS.NET 2002/2003 2 May 23rd, 2004 08:06 AM
Events Question nhdw Beginning VB 6 2 February 23rd, 2004 04:00 PM



All times are GMT -4. The time now is 01:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.