Registering Entity Types for Serialization

In Bloqs, all entity class types must be registered in a central list so they can be correctly serialized for both the API and storage. Without registering the types, the framework will not recognize them during data transfer or persistence.

Example

public static List<Type> GetTypes()
{
    return
    [
        typeof(Activity),
        typeof(Category),
        typeof(Organization),
        typeof(UserAccount),
        typeof(OrganizationTenant),
        typeof(SendMailInput),
    ];
}

Explanation

  • Each typeof(...) entry registers an entity type with the system.

  • This ensures proper serialization and deserialization when:

    • Entities are stored in storage.

    • Data is sent or received via the Web API.

  • If you add a new entity class to your app (e.g., Product or Invoice), you must also add it to this list.

Best Practice

Keep this list up to date with all entity classes in your solution. This ensures that Bloqs can always serialize data correctly across API, storage, and UI layers.

Last updated