Skip to content

[SimpleModel]

IntelliTect.Coalesce.SimpleModelAttribute

Used to mark a class as a Simple Model for generation by Coalesce. Must be used in conjunction with the [Coalesce] attribute.

Usage

The [SimpleModel] attribute is used alongside the [Coalesce] attribute to explicitly include a standalone class as a Simple Model in your Coalesce application. This is particularly useful for data transfer objects, configuration objects, or other data classes that are not naturally discovered through the typical Coalesce discovery process.

c#
[Coalesce]
[SimpleModel]
public class ReportSettings
{
    public string Format { get; set; }
    public bool IncludeCharts { get; set; }
    public string Theme { get; set; }
}

Generated Code

When a type is marked with [SimpleModel], Coalesce will generate:

Restrictions

The [SimpleModel] attribute should only be used on regular class types. It cannot be used on:

  • Interfaces
  • Enums
  • Types that already have special Coalesce roles (like [Service], [StandaloneEntity], etc.)
  • Types that implement Coalesce interfaces (like IDataSource<>, IBehaviors<>, etc.)

Using [SimpleModel] on inappropriate types will generate analyzer warnings to help guide correct usage.


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.