Skip to content

[LoadFromDataSource]

IntelliTect.Coalesce.DataAnnotations.LoadFromDataSourceAttribute

Specifies that the targeted model instance method should load the instance it is called on from the specified data source when invoked from an API endpoint. If not defined, the model's default data source is used.

Example Usage

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

    [Coalesce, LoadFromDataSource(typeof(WithoutCases))]
    public void ChangeSpacesToDashesInName()
    {
        FirstName = FirstName.Replace(" ", "-");
    }
}

Properties

// ONLY settable via constructor parameter #1
public Type DataSourceType { get; }

The name of the Data Source to load the instance object from.


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.