Closed memeny closed 4 years ago
Hi, the issue is that in AutoFac, registering a type is different from registering a generic type and you need to use RegisterGeneric
.
As such, just add a condition:
if (t1.IsGeneric)
builder.RegisterGeneric(t2).As(t1);
else
....
So it is just the way Autofac works.
Does this help?
Thanks Ali, that’s sorted it.
Presumably you have added some generic types to v2.7.4 – great that I’ve been able to upgrade now.
Thanks again for your efforts with this library – really useful.
From: Ali Kheyrollahi notifications@github.com Sent: 13 July 2020 21:08 To: aliostad/CacheCow CacheCow@noreply.github.com Cc: Mark Emeny mark@littlemansolutions.net; Author author@noreply.github.com Subject: Re: [aliostad/CacheCow] CacheCow.Server.DefaultCacheDirectiveProvider registration problems in v2.7.4 (#254)
Hi, the issue is that in AutoFac, registering a type is different from registering a generic type and you need to use RegisterGeneric.
As such, just add a condition:
if (t1.IsGeneric)
builder.RegisterGeneric(t2).As(t1);
else
....
So it is just the way Autofac works.
Does this help?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/aliostad/CacheCow/issues/254#issuecomment-657764803, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AF2MKQFRIMYL3ULY4DK7DETR3NSRHANCNFSM4OYKKJJA.
Awesome! Thanks for using CacheCow.
I have tried v2.7.4 and am now having problems with my Autofac registration code, using the "standard" method to register CacheCow's internal implementations:
The reported exception is:
"System.ArgumentException: 'The type 'CacheCow.Server.DefaultCacheDirectiveProvider
1[TViewModel]' is not assignable to service 'CacheCow.Server.ICacheDirectiveProvider
1'.'"