# Set settings

`IConfigurator<>` is the main service to write settings.

Example: Inject `IConfigurator<>` into a command handler:

```csharp
public class EditEmailSettingsCommandHandler : ICommandHandler<EditEmailSettingsCommand>
{
    private readonly IConfigurator<SmtpEmailSettings> _configurator;

    public EditEmailSettingsCommandHandler(IConfigurator<SmtpEmailSettings> configurator)
        => _configurator = configurator;

    public Task HandleAsync(EditEmailSettingsCommand command)
    {
        // Configure settings by command data.
        _configurator.Configure(settings =>
        {
            settings.Host = command.Host;
            settings.Port = command.Port;
        });
    }
}
```

Simple settings modification mechanism out of the box is one of the most distinguishing features from the Microsoft [Options pattern](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.structr.dev/utilities/configuration/set-settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
