Skip to content

[Inject]

Used to mark a Method parameter for dependency injection from the application's IServiceProvider.

See Methods for more.

This gets translated to a Microsoft.AspNetCore.Mvc.FromServicesAttribute in the generated API controller's action.

Example Usage

c#
public class Person
{
    public int PersonId { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    public string GetFullName([Inject] ILogger<Person> logger)
    {
        logger.LogInformation("Person " + PersonId + "'s full name was requested");
        return FirstName + " " + LastName";
    }
}

Coalesce is a free and open-source framework created by IntelliTect to fill our desire to create better apps, faster. IntelliTect is a high-end software architecture and development consulting firm based in Spokane, Washington.

If you're looking for help with your software project, whether it be a Coalesce application, other technologies, or even just an idea, reach out to us at info@intellitect.com — we'd love to start a conversation! Our clients range from Fortune 100 companies to local small businesses and non-profits.