Hi Per,
good point about the overload. I think we can add that quite easily as
this is not a breaking change.
While I can see your point with the code sample you provided and I'm
happy to discuss this further, it would need to wait until next major
release.
Feel free to add both those request to the issue tracker.
cheers,
@K
On 17/02/2012 12:06 AM, Lundberg, Per wrote:
Hi!
It would be nice if it would be possible to do something like this:
internal static ComponentRegistration<object>
ConfigurePropertyInjection(this ComponentRegistration
componentRegistration)
{
ComponentRegistration<object> result =
componentRegistration.Configuration();
result = result.Properties(pi =>
pi.HasCustomAttribute<InjectAttribute>(), isRequired: true);
result = result.Properties(pi =>
pi.HasCustomAttribute<InjectOptionallyAttribute>(), isRequired: false);
return result;
}
I’ve tried it, but the problem is that the first line means that all
properties that would be matched by the second predicate has already
been filtered away… which means that things won’t work as I’ve expected.
Maybe I can get around it by using a custom
ComponentModelConstructionContributor, but it would be nice to be able
to do it otherwise. Suggestion: add a new overload for Properties()
which takes a Func<PropertyInfo, SomeCustomType> as parameter. In the
CustomType object, there should be one flag for saying whether the
property should be injected or not, and one flag for saying whether it
should be set up using /mandatory/ or /optional/ injection.
Please, let me know if there’s already some other (easy) way to get
this done.
Best regards,
-- -- -- -- -- -- -- --**
*PER LUNDBERG*/Software Engineer
/[email protected]
<mailto:[email protected]>www.ecraft.com <http://www.ecraft.com/>
tel. +358 (0) 20 759 8687
eCraft Oy Ab, Wolffskavägen 36, FI-65200 Vasa
--
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.