Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ServiceComposer/ServiceComposer.AspNetCore/llms.txt

Use this file to discover all available pages before exploring further.

Version 4.0.0 removes the dependency on Newtonsoft.Json and replaces it with the built-in System.Text.Json. This delivers a leaner dependency graph and aligns ServiceComposer with the standard ASP.NET Core serialisation stack. The change also necessitates a switch in the default view model type, because System.Text.Json cannot serialize DynamicObject.
The Newtonsoft.Json dependency has been removed in v4.0.0. Any code that relied on Newtonsoft-specific serialization behaviour, JsonSerializerSettings, or DynamicObject view model merging will need to be updated.
1

Remove Newtonsoft.Json dependency

ServiceComposer no longer depends on Newtonsoft.Json. If your project references it solely to configure ServiceComposer serialisation, you can remove the package reference. If other parts of your application still require Newtonsoft, keep the reference but remove any ServiceComposer-specific configuration that relied on it.
2

Adjust for ExpandoObject default view models

System.Text.Json does not support serializing types that inherit from DynamicObject. The default view model has therefore changed from a custom DynamicObject subclass to ExpandoObject.
This change should have no impact on most user code, because all previously-supported view model features (raising events, accessing request IDs, etc.) were already moved to ICompositionContext in v3.
The DynamicViewModel.Merge(dynamic) method is no longer supported. If your handlers relied on merging two view models, refactor that logic to populate the ExpandoObject view model directly via the composition context.
3

Update custom serialization options

If you were using UseCustomJsonSerializerSettings to supply a JsonSerializerSettings instance (Newtonsoft), update the call to supply a Func<HttpRequest, JsonSerializerOptions> factory (System.Text.Json) instead. The method is accessed via options.ResponseSerialization:
builder.Services.AddViewModelComposition(options =>
{
    options.ResponseSerialization.UseCustomJsonSerializerSettings(_ =>
    {
        return new JsonSerializerOptions()
        {
            // customize options as needed
        };
    });
});

Build docs developers (and LLMs) love