Summary#
[Title(Number, Subject)] on an entity names what each of its records is called: here its number and subject, joined
with " · ". A template says it in your own words — [Title($"#{Number} · {Subject}")]. Anything that shows a record it
did not declare — a notification's line, a feedback comment, a link — asks Records.Title(x), and
gets this.
Signature#
[Title(Member1, Member2, …)] // the members' values, joined with " · ", empty ones left out
[Title($"#{Number} · {Subject}")] // an interpolated template over the record's own members
entity <Name> { … }Description#
What is a record called without one?#
Its first [Required] text member — a Name, a Title, a Subject is usually exactly right, which is why most
entities need no [Title] at all. With none, its type's noun ("Ticket").
Does a derived type inherit it?#
Yes. A type with no [Title] of its own is called by its nearest ancestor's; one of its own replaces it.
Is it translated?#
The values are the record's own; the literal words in a template are not translated yet. Keep a template to
punctuation and numbers (#{Number} · {Subject}) where the app speaks more than one language.
Where is it on the page?#
[Title] on a page component is the same idea for a route — its name, for chrome that names a route. On an entity it
names each record.
Examples#
Counter OrderNumber = new() { Start = 1000 };
/// "#1042 · Two city bikes"
[Title($"#{Number} · {Summary}")]
entity Order {
[Counter(OrderNumber)] int Number;
[Required, MaxLength(200)] string Summary;
security { allow read, create when IsAuthenticated; }
}
/// "Ada Lovelace · London"
[Title(Name, City)]
entity Customer {
[Required, MaxLength(100)] string Name;
[MaxLength(100)] string City = "";
security { allow read, create when IsAuthenticated; }
}
/// No [Title]: called by its first required text — "Spring catalogue".
entity Catalogue {
[Required, MaxLength(100)] string Label;
security { allow read, create when IsAuthenticated; }
}
public string Called(Order o, Customer c, Catalogue k) {
return Records.Title(o) + " | " + Records.Title(c) + " | " + Records.Title(k);
}See also#
- Records — what any record is called, where it opens, who may read it —
Records.Title,Link,NounandMayRead, for any record - Entity — a reference to a record of any type, which shows its title
- entity — the
entitydeclaration itself