Grace
Grace copied to clipboard
Updated documentation
For example:
How is TypesThat
used?
How do we correctly use ExportAssembly
More samples regarding fluent API usage.
For example, I did this:
To register all the Tools in a given assembly as Tool
, so an injection like IEnumerable<Tool>
works I did:
registrationBlock.Export(toolType.Assembly.ExportedTypes
.Where(TypesThat.AreBasedOn<Tool>())
.Where(x => !x.IsAbstract))
.ByTypes(type => new[] { toolType });
Is there a better, simplified way to achieve that?
Another example. Does this look OK?
registrationBlock.ExportAssemblies(Assemblies.AppDomainAssemblies)
.Where(y => typeof(ISection).IsAssignableFrom(y))
.ByInterface<ISection>()
.ByInterface<IBusy>()
.ByType()
.ExportAttributedTypes()
.Lifestyle.Singleton();
BTW: I could collaborate with the docs, but I don't know how to do it 😥
Hi José,
I’m out of town today but I’ll reply tomorrow with an in-depth answer
So looking at your examples both look correct. I think ultimately it really comes down to do you like using linq yourself or do you want to have the container do it for you.
that seems to Grace does not provide simplified inside the bulk registration API ?
Hi @sgf
What type of simplification are you looking for?
like these: https://github.com/z4kn4fein/stashbox/wiki/Assembly-registration https://github.com/seesharper/LightInject#assembly-scanning
In fact, it's not essential, but if any easier
@sgf there are a number of export functions that work on lists of types that are quite similar to what you posted for example ExportAssemblyContaining<T>
.
What are you looking for specifically?
@sgf there are a number of export functions that work on lists of types that are quite similar to what you posted for example
ExportAssemblyContaining<T>
.What are you looking for specifically?
I'm sorry, I didn't find it in the documentation. So I thought your project was not supported.
Now, you tell me that ExportAssemblyContaining<T>
, thank you very much.
It seems that the problem I raised does not exist. 😂