You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Rin with an ASP.NET Core 6.0 web API and I found that the options given to Rin via the
public static IRinBuilder AddRin(this IServiceCollection services, Action<RinOptions>? configure = null)
extension method are disregarded. (In my concrete case retention max stays at 100 elements.)
I had a look into the code and it seems to me this is due to the way aforementioned extension method is written: it registers the RinOptions instance previously given to calling end users via lambda expression and registers it as a singleton instance.
In order to use options this way however, the RinOptions instance should be registered as an explicit option and since it isn't a default option instance is handed over to the consuming service.
As a workaround, I can set the max number of retained records after calling AddRin() without parameters: services.AddOptions<RinOptions>().Configure(o => o.RequestRecorder.RetentionMaxRequests = 6);
I guess it should probably suffice to adapt the RinOptions registration logic in AddRin (set the case the all other services also consume the instance via IOption<T>).
The text was updated successfully, but these errors were encountered:
Hi,
I'm using
Rin
with anASP.NET Core
6.0 web API and I found that the options given toRin
via thepublic static IRinBuilder AddRin(this IServiceCollection services, Action<RinOptions>? configure = null)
extension method are disregarded. (In my concrete case retention max stays at 100 elements.)
I had a look into the code and it seems to me this is due to the way aforementioned extension method is written: it registers the
RinOptions
instance previously given to calling end users via lambda expression and registers it as a singleton instance.Later, services such as
InMemoryRecordStorage
consume the option via DI but wrapped by IOption.In order to use options this way however, the
RinOptions
instance should be registered as an explicit option and since it isn't a default option instance is handed over to the consuming service.As a workaround, I can set the max number of retained records after calling
AddRin()
without parameters:services.AddOptions<RinOptions>().Configure(o => o.RequestRecorder.RetentionMaxRequests = 6);
I guess it should probably suffice to adapt the
RinOptions
registration logic inAddRin
(set the case the all other services also consume the instance viaIOption<T>
).The text was updated successfully, but these errors were encountered: