Skip to content

entities

vijay@envivo edited this page Jun 8, 2026 · 4 revisions

Objects and Entities

Entities are the basic building block of your model.

Create your classes inside the appropriate Subdomain namespace. For Fresnel to display the class, it must have the following:

  • A public constructor
  • A public GUID property named Id
using System;

namespace Acme.OnlineShopping.CustomerAccounts
{
    /// <summary>
    /// A record of a payment for an Order
    /// </summary>
    public class Payment
    {
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public Guid Id { get; init; } //👈

        /// <summary>
        /// The time the payment was made
        /// </summary>
        public DateTime PaidAt { get; set; }

        /// <summary>
        /// The amount paid
        /// </summary>
        public double TotalAmount { get; set; }

        /// <summary>
        /// Any special notes about this payment
        /// </summary>
        public string Notes { get; set; }
    }
}

Alternatively, you can add the Fresnel ModelTypes library, and implement the IEntity interface:

using Envivo.Fresnel.ModelTypes.Structural;
using System;

namespace Acme.OnlineShopping.CustomerAccounts
{
    /// <summary>
    /// A record of a payment for an Order
    /// </summary>
    public class Payment : IEntity //👈
    {
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public Guid Id { get; init; }

        /// <summary>
        /// The time the payment was made
        /// </summary>
        public DateTime PaidAt { get; set; }

        /// <summary>
        /// The amount paid
        /// </summary>
        public double TotalAmount { get; set; }

        /// <summary>
        /// Any special notes about this payment
        /// </summary>
        public string Notes { get; set; }
    }
}

Any code comments appear in the UI as tooltips. It is vital that these comments reflect the contextual business language of the domain and are understandable by both people and AI models. This makes it really useful when demonstrating and discussing your model with other people:

If a class has a public constructor, you can create instances of it in the UI:

A new explorer panel will appear, showing the detail of the entity:

If you need a quick 'summary info' to appear in the explorer's title, overload the ToString() method:

public override string ToString()
{
    return $"{Title} {FirstName} {LastName}";
}

This makes the object easier to identify within the UI:

Clone this wiki locally