I don't think this is a good idea, or a good engineering practice
On 04/02/2011 5:49 AM, Nicholas Kilian wrote:
Why not add an overload so you can smother exceptions (bool throw)?
There are a few calls in the .net framework itself that offer this,
and it would prevent breaking changes.
*From:*[email protected]
[mailto:[email protected]] *On Behalf Of *Dru Sellers
*Sent:* 03 February 2011 09:28 PM
*To:* [email protected]
*Subject:* Re: Registering a Facility Twice throws an exception
I would love this:
- Make AddFacility method behave like Add in HashSet, that is return
true and do add the facility if it's not there yet, or ignore the
call, don't throw and return false
Instead of bool it could be an Enum? Either way though I would be happy.
-d
2011/1/31 Krzysztof Koźmic <[email protected]
<mailto:[email protected]>>
I have already made a change in the trunk some time ago that throws
immediately if you've added the same facility twice with more
descriptive message.
Having said that - I do understand the scenario Dru is facing, and
actually we have a (minor) dependency on TFF in WCF Facility too,
although we don't register it there.
So other than just leaving it as is, I have two proposed solutions for
that:
- Make AddFacility method behave like Add in HashSet, that is return
true and do add the facility if it's not there yet, or ignore the
call, don't throw and return false
- Make TypedFactoryFacility available OOTB in the container, that is
pre-register it.
- Mix the above approaches, so that we don't break existing clients -
their calls to AddFacility<TFF> will just be ignored and everything
will work
- Anything else?
HTH,
Krzysztof
On 01/02/2011 6:59 AM, Dru Sellers wrote:
If you look at my first post I am already using GetFacilities() and it
is working just fine.
2 different 3rd party facilities? At this point not many projects
outside of castle actually ship with Windsor Facilities, so I am not
to worried about that.
I was really just looking for a shortcut method. :)
-d
On Mon, Jan 31, 2011 at 2:50 PM, Jason Meckley <[email protected]
<mailto:[email protected]>> wrote:
I'm not familiar with getfacilities(). that may be another option. I
don't like adding facilities from within one another, for the scenario
you are currently facing. what if 2 different 3rd party facilities add
the typed factory facility? you could resolve the scenario you are facing.
to keep the facility frictionless you could reverse the "add facility"
logic I proposed above. have a configuration option to not add the
facility. this would be used in advanced/custom configuration scenarios.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:castle-project-users%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:castle-project-users%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Castle
Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.