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
Describe your issue
Following your tutorial, I am registering all the necessary services in StartUp and TestStartup as well. However, they are generic and I believe that there is some problem with their resolving because it simply does not work out for me.
Project files
This is the generic controller feature provider we have configured.
publicclassGenericControllerFeatureProvider:IApplicationFeatureProvider<ControllerFeature>{privatereadonlystring_entityIdType;publicGenericControllerFeatureProvider(IConfigurationrunningConfiguration){if(runningConfiguration==null)thrownewArgumentNullException(nameof(runningConfiguration));this._entityIdType=runningConfiguration["EntityIdType"];if(string.IsNullOrWhiteSpace(this._entityIdType))thrownewException(ExceptionMessages.YouMustSpecifyEntityIdTypeInAppsettings);}publicvoidPopulateFeature(IEnumerable<ApplicationPart>applicationParts,ControllerFeaturecontrollerFeature){varpublicTypes=typeof(GenericControllerFeatureProvider).Assembly.GetExportedTypes();varbaseControllerType=typeof(IMyGenericController<>);vargenericControllers=publicTypes.Where(
t =>t.ContainsGenericParameters&&t.IsClass&&t.GetInterfaces().Any(i =>i.IsGenericType&&i.GetGenericTypeDefinition()==baseControllerType)).ToList();Type[]typeArgs={Type.GetType(this._entityIdType)};foreach(vargenericControlleringenericControllers){vargenericType=genericController.MakeGenericType(typeArgs).GetTypeInfo();controllerFeature.Controllers.Add(genericType);}}}
This controller model convention is used to beautify the controller name if it is displayed in Swagger dor example.
Expected behavior
Calling a controller action without .Withdependencies(...) should work appropriately - take services internally from ASP and pass them to the requested controller's constructor)
Environment:
OS: Windows 10
ASP.NET Core Version 3.1
The text was updated successfully, but these errors were encountered:
Describe your issue
Following your tutorial, I am registering all the necessary services in StartUp and TestStartup as well. However, they are generic and I believe that there is some problem with their resolving because it simply does not work out for me.
Project files
This is the generic controller feature provider we have configured.
This controller model convention is used to beautify the controller name if it is displayed in Swagger dor example.
Startup classes
This is the TestStartup class - nothing special.
Expected behavior
Calling a controller action without
.Withdependencies(...)
should work appropriately - take services internally from ASP and pass them to the requested controller's constructor)Environment:
The text was updated successfully, but these errors were encountered: