Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: implementation #1

Open
zygimantas opened this issue Mar 1, 2016 · 5 comments
Open

Q: implementation #1

zygimantas opened this issue Mar 1, 2016 · 5 comments

Comments

@zygimantas
Copy link

Hi, a lot of time passed after the creation of this project. Do you still consider it is the most elegant way to implement domain events with c#? Do you have any other updates or recommendations? Thanks in advance.

@zygimantas zygimantas changed the title Q: Q: implementation Mar 1, 2016
@zygimantas
Copy link
Author

@bsommardahl , I also miss IBlingInitializer and sample implementation, mentioned in this article: http://awkwardcoder.com/2012/08/28/nhibernate-lazy-loading-blingbag/ (I am interested in situation where Lazy loading and NHibernate is irrelevant and fully initialized entities are retrieved from the repository).

@bsommardahl
Copy link
Owner

@zygimantas If you are triggering events from command handlers, then I would consider BlingBag the best way to do it. Most of the implementations of domain events use messy static classes. BlingBag uses normal c# events and handlers.

On the other hand, if you're triggering domain events using event sourcing, I would not use BlingBag.

Blingbag is still used in production and is implemented into new projects all the time. I know I don't maintain the code very often... that's true. :( But the project is still viable and in use.

I just checked on IBlingInitializer and I can't seem to find the implementation. I have a feeling it was replaced with something else, but somehow we didn't update the rest of the code-base. I'll see if I can check on that today.

@zygimantas
Copy link
Author

Thanks @bsommardahl I am planning to raise events from command methods inside domain entities without using event sourcing. I will be looking forward for your update, because this missing part prevents to see the complete picture.

@zygimantas
Copy link
Author

@bsommardahl any success finding the source?

@bsommardahl
Copy link
Owner

Yes. I believe it was removed because it was no longer needed. The job of
the initializer was to subscribe to the events on a class using the
dispatcher. So, instead of the extra service performing that
"initialization", just subscribe to the events directly. I'm not at a
computer right now or I would include a sample.

Assume your command handlers all have an event on them called
"NotifyObservers". In your command dispatcher, before executing the command
handler for a given command, "initialize" it by subscribing to like this:

NotifyObervers += domainEvent => _blingDispatcher.Dispatch(domainEvent);

That's all there is to it. Feel free to reply with more questions. I'll be
back on the computer on Monday.
On Fri, Mar 4, 2016 at 4:27 PM Zygimantas Berziunas <
notifications@github.com> wrote:

@bsommardahl https://github.com/bsommardahl any success finding the
source?


Reply to this email directly or view it on GitHub
#1 (comment).

Byron Sommardahl
CTO, Co-Owner
Acklen Avenue | www.acklenavenue.com | 615-669-8239
632 Fogg Street Suite 8, Nashville, TN 37212

Acklen Avenue is a custom software development company committed
to creating quality software that people love to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants