-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Support for composite decorators #265
Comments
@Simble You should be able to do that now. You do just mean wrapping decorators in decorators, right? That should work out of the box, but I'll admit that I never thought to try that. |
Hi @jeremydmiller, thank you for getting back to me. By composite (decorator) pattern I meant a situation as described in the code below. public interface ISomething
{
IEnumerable<string> GetNames();
}
public class One : ISomething
{
public IEnumerable<string> GetNames() => new[] { "one" };
}
public class Two : ISomething
{
public IEnumerable<string> GetNames() => new[] { "two" };
}
public class SomethingComposite : ISomething
{
private readonly IEnumerable<ISomething> _others;
public SomethingComposite(IEnumerable<ISomething> others)
{
_others = others;
}
public IEnumerable<string> GetNames() => _others.SelectMany(other => other.GetNames());
} Is it possible to achieve this? I really like Lamar and use this pattern a lot, to adhere to the single responsibility principle. |
"I think so" or " I dont' know why that wouldn't work" is the answer |
Unfortunately I am getting a bi-directional exception. |
Do you have repro steps? |
Does and/or will Lamar have support for composite decorators? Like StructureMap.
If not, is there an alternative approach to achieving the same result?
The text was updated successfully, but these errors were encountered: