Closed AliveDevil closed 1 year ago
Hi, I'll merge this. One q: do you think we can come up with something better than "MethodBased"? Just want to know if you have some ideas on that - I tend to dislike unnecessarily long names, but struggle to find a name that describes this well :)
Maybe something like "AutoFactory"?
(just throwing some ideas, i.e. this is not my preference)
So, my ideas:
Add*Factory<T>() T : class, IRequiresAsyncProxy
(taking any interface)So AddClassFactoy, AddTypeFactory, AddAutoFactory. With "Add(Singleton|Scoped)". Don't know whether Transient would be necessary.
Auto Factory is fine as well. Not that good either with naming things.
Renamed to TypeFactory and made some changes to how this extension can be consumed (overwrite either Proxy or Interceptor type).
TypeFactory now takes class, IRequiresAsyncProxy
, which should be sufficient. Adding an interface just for annotation seemed a bit too much, as there already is Requires Async Proxy.
LGTM, will merge this PR today or tomorrow - thanks!
@AliveDevil I slightly edited this, but no changes to the way it works: https://github.com/servicetitan/Stl.Fusion/commit/49c60c13e080acbe64627aa4c552f468c79aa875
Mostly, it's "TypeFactory" -> "TypedFactory", + I removed a bunch of excessive methods :)
And added one more test.
Full interface for TypeFactory:
Remarks:
IServiceCollection(IServiceCollection, …, ServiceLifetime)
By convention (AddScoped
,AddSingleton
) or by parameter)TFactory
is mentioned, assumewhere TFactory : class, IRequiresAsyncProxy
TProxy
is mentioned, assumewhere TProxy : TFactory
TInterceptor
is mentioned, assumewhere TInterceptor : Interceptor
Resolves #649