Flow Studio
Entity Schema Resolution
How an entityType string key resolves to the correct service, backing table, and field schema via IEntitySchemaRegistry.
IEntitySchemaRegistry
public interface IEntitySchemaRegistry
{
EntitySchema GetSchema(string entityType);
bool TryGetSchema(string entityType, out EntitySchema schema);
IReadOnlyCollection<string> RegisteredEntityTypes { get; }
}
public record EntitySchema
{
public string EntityType { get; init; } = default!;
public string ServiceName { get; init; } = default!; // e.g., "PayrollService"
public string TableName { get; init; } = default!; // e.g., "Invoices"
public string PrimaryKeyField { get; init; } = "id";
public string VersionField { get; init; } = "_version";
public EntityFieldSchema[] Fields { get; init; } = [];
}
Registering an Entity Type
// In your module's DI registration:
services.AddEntitySchema(new EntitySchema
{
EntityType = "invoice",
ServiceName = "FinanceService",
TableName = "Invoices",
PrimaryKeyField = "invoiceId",
Fields = [
new("invoiceNumber", EntityFieldType.String, required: true),
new("total", EntityFieldType.Decimal, required: true),
new("currency", EntityFieldType.String, required: true),
new("status", EntityFieldType.String, required: true),
new("lineItems", EntityFieldType.Array, required: false),
new("vendorId", EntityFieldType.String, required: true)
]
});
Resolution at Runtime
// Inside EntityReadExecutor:
var schema = _schemaRegistry.GetSchema(config.EntityType);
// schema.TableName → "Invoices"
// schema.PrimaryKeyField → "invoiceId"
var result = await _entityClient.ReadAsync(new ReadEntityRequest
{
Schema = schema,
EntityId = entityId,
Fields = config.Fields,
TenantId = ctx.TenantId
}, ct);
Node palette: The Flow Studio designer shows all registered entity types in the entity node dropdowns. If your new entity type doesn't appear, verify the DI registration ran at startup and the application restarted.