Skip to content

Support in Net Core Asp.Net #472

Answered by axunonb
gregoriusus asked this question in Q&A
Discussion options

You must be logged in to vote

With AspNet Core and SmartFormat 3.5.3 you could provide the configured formatter for DI like this:

services.AddTransient<SmartFormatter>(sp =>
{
    var smart = new SmartFormatter(new SmartSettings {

        // Configure the SmartSettings here if needed
    });

    // Configure the SmartFormatter here if needed
    smart.AddExtensions(SmartFormat.Extensions.GlobalVariablesSource.Instance);

    return smart;
});

The upcoming SmartFormat 3.6 aims to be thread-safe, so it could be added as singleton.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by axunonb
Comment options

You must be logged in to vote
1 reply
@axunonb
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #471 on March 16, 2025 09:16.