inline 2010/3/10 Krzysztof Koźmic <[email protected]>
> On 3/10/2010 10:15 PM, Simone Busoli wrote: > > > > 2010/3/10 Krzysztof Koźmic <[email protected]> > >> On 3/10/2010 9:59 PM, Simone Busoli wrote: >> >> inline >> >> 2010/3/10 Krzysztof Koźmic <[email protected]> >> >>> you put interceptors in whatever order you please. >>> >> >> how? >> >> You create the array yourself in the selector. You choose what to put >> there, and in what order. it doesn't even have to have anything in common >> with componentModel.Interceptors collection >> > > Can you see that all interceptors in model.Interceptors are appended > after those selected by all selectors? > > Yes, I can see that. I would execute that code only when no selector has > opinion about component model in question. > I'm not sure that would be a good choice, but we definitely need to define what selectors are for. In my opinion they should have a chance to modify the existing collection of interceptors. If they don't care about the order then they will eventually append their stuff otherwise they will do nothing. With the current code we're really looking for bugs with duplicate interceptors appended at the end. > > > >> >> >> >>> between selectors order of selectors transfers to order of >>> interceptors. Plus I think you should not have multiple selectors for >>> one model so it's a non-issue anyway. >>> >> >> why? I'm using multiple selectors to apply different and unrelated >> concerns to models. Do you think I should centralize a bunch of unrelated >> stuff into the same class? >> >> Give me a scenario. But despite of it, doesn't order of selectors give >> you enough control? >> > > A selector handling whether we need to add transaction interceptor and > another handling exception-related stuff. > Ideally I wouldn't like to depend on the order of selectors and put that > logic in the selectors themselves, for instance, transaction interceptor > should be last. (in this I would like to extend > InterceptorReferenceCollection to support keeping an interceptor in a > certain position even if other interceptors are added later) > > now we're talking :) > I still think that you can achieve this with ordering of selectors without > changing the interface. Plus you always can use IInterceptorSelector to > select/order interceptors at a method level. > Would you be confident in relying on the order in which you register your selectors? I'd prefer to let the selector itself decide where to put its interceptor/s. > > >> >> >>> in addition I'm against passing interceptors selected by one selector, >>> to subsequent selectors. >>> >> >> this is the current code. how do you apply order? how do you remove >> interceptors? >> >> foreach(IModelInterceptorsSelector selector in selectors)// selectors >> are asked in order you register them in >> { >> InterceptorReference[] interceptors = >> selector.SelectInterceptors(model); >> >> + if (interceptors == null) >> + { >> + continue; >> + } >> + >> + foreach (InterceptorReference interceptor in interceptors) >> + yield return interceptor; // interceptors are returned in order >> selector put them in the array >> } >> + >> + foreach (InterceptorReference interceptor in model.Interceptors) >> + yield return interceptor; >> } >> >> Note that model.Interceptors are concatenated to anything returned by > selectors, so you don't have control unless you modify the collection > directly. > > >> >> >>> >>> 2010/3/10 Simone Busoli <[email protected]>: >>> > Except that I don't agree with this principle, the return value >>> doesn't let >>> > you specify where exactly to put the interceptor. So the return value >>> > provides a subset of the functionality provided by the input >>> collection. >>> > >>> > 2010/3/10 Krzysztof Koźmic <[email protected]> >>> >> >>> >> void methods should not modify their arguments >>> > >>> > -- >>> > 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]<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]. >>> To unsubscribe from this group, send email to >>> [email protected]<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]. >> 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]<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] > . > 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]<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]. 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.
