ProNotion
12/05/2023, 10:00 AMIApiContentResponseBuilder
- do I need to remove the default one first or will mine override the default when registered via an IComposer
?Sebastiaan
12/05/2023, 10:18 AMProNotion
12/05/2023, 11:20 AMProNotion
12/05/2023, 11:28 AMIApiContentResponseBuilder
via an IComposer
but in doing so the site will no longer start up - it doesn't error, just doesn't appear to complete loading and hangs.Sebastiaan
12/05/2023, 12:36 PMProNotion
12/05/2023, 12:39 PM{
"@t": "2023-12-05T12:27:54.2578701Z",
"@mt": "Duplicate field definitions found for field name {FieldName} among the index handlers - first one wins.",
"@l": "Warning",
"FieldName": "domain",
"SourceContext": "Umbraco.Cms.Infrastructure.Examine.DeliveryApiContentIndexFieldDefinitionBuilder",
"ProcessId": 64520,
"ProcessName": "iisexpress",
"ThreadId": 1,
"ApplicationId": "70db158a02c3b1c83279642af486f7e5db1ff92b",
"MachineName": "PN-MEGATRON",
"Log4NetLevel": "WARN "
}
Currently leaving it for a while to see if it will ever complete loading but not looking hopeful at the moment.ProNotion
12/05/2023, 2:00 PMIComposer
. If I comment out the line below the warning above is not the last line in the logs and the site loads.
builder.Services.AddSingleton<IApiContentResponseBuilder, MyContentResponseBuilder>();
ProNotion
12/12/2023, 3:58 PMIOutputExpansionStrategy
and have implemented my own version of the method MapProperties(IPublishedContent content, IEnumerable<IPublishedProperty> properties)
ProNotion
12/19/2023, 11:28 AMIApiContentResponseBuilder
and have finally narrowed down the issue with Umbraco hanging and never starting up. It is caused by the fact that my implementation takes an additional parameter IMappingHelper mappingHelper
. That class takes a IUmbracoMapper mapper
parameter.
I am registering my implementations as follows:
builder.Services.AddSingleton<IMappingHelper, MappingHelper>();
builder.Services.AddSingleton<IApiContentResponseBuilder, BaseContentResponseBuilder>();
I am registering IMappingHelper
as a singleton because it can't be scoped due to being a parameter for the IApiContentResponseBuilder
singleton.
I'm now banging my head against a wall - probably missing something really obvious but it's not very helpful when there is no error to provide some insight into the issue that is occurring with the service registration.
Any ideas?ProNotion
12/19/2023, 12:22 PMIApiContentResponseBuilder
constructor and adding it to the IOutputExpansionStrategy
and it now all works as intended. However, I am still interested to know how to make it work in the original context and why it was not working previously.Serhii R
05/17/2024, 11:11 AMIApiContentResponseBuilder
, but it should be scoped in my case. That is because I need to inject my list of scoped services into it. Can I override it as scoped?
umbracoBuilder.Services.AddScoped<IApiContentResponseBuilder, CustomDeliveryApiResponseBuilder>();
When I changed AddSingleton to AddScoped that looked working, but I want to ensure there are no pitfalls of change.