Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
eee1169
FullStack takes any column's name: one named like a member it generat…
ejsmith Nov 26, 2026
36d79b1
LookupEnums and Csla warn whoever generates with CodeTemplate.Warning…
ejsmith Nov 26, 2026
98d0217
Legacy README: PLINQO's entity files can use today's C# and VB (=> me…
ejsmith Nov 26, 2026
199e687
Csla: a schema snapshot's web app is wired for the database it was ta…
ejsmith Nov 26, 2026
f23d4f8
Merge branch 'fix/codefileparser-modern-csharp' into fix/pending-2026…
ejsmith Nov 26, 2026
fbf6967
ModernEntities' EF Core templates (and FullStack's and Csla's copies)…
ejsmith Nov 26, 2026
887a5f8
ModernEntities' EF Core templates (and FullStack's and Csla's copies)…
ejsmith Nov 26, 2026
32a58d3
PLINQO's Entities.cst keeps each member of an entity's Metadata class…
ejsmith Nov 26, 2026
76427d9
PLINQO's Dbml.cst fills in the dbml's default values (Mode="Connectio…
ejsmith Nov 26, 2026
812e7a5
PLINQO-EF-DbContext's sample Petshop.csp no longer sets IgnoreList an…
ejsmith Nov 26, 2026
05a94c2
PLINQO: README.md describes the templates and the Metadata class (wha…
ejsmith Nov 26, 2026
f780a4f
FullStack's and Csla's labels come from one routine, NameWords.Label,…
ejsmith Nov 26, 2026
e0f9850
TableToClass's Records.cst and ModernEntities' (and FullStack's) Enti…
ejsmith Nov 26, 2026
08e58ce
FullStack takes a real schema: PostgreSQL arrays are lists, bit strin…
ejsmith Nov 26, 2026
97ee589
Csla takes a real database's schema: arrays are read-only lists CSLA'…
ejsmith Nov 26, 2026
3fc805e
DBDocumenter's title and server are the database's name and the serve…
ejsmith Nov 26, 2026
98c0379
ModernEntities' README says what the configurations map for each data…
ejsmith Nov 26, 2026
a184fc0
Merge branch 'fix/d4-csla' into fix/pending-2026-11-25
ejsmith Nov 26, 2026
34e7b5b
Merge branch 'fix/d4-fullstack' into fix/pending-2026-11-25
ejsmith Nov 26, 2026
bff214e
Merge branch 'fix/d4-plinqo' into fix/pending-2026-11-25
ejsmith Nov 26, 2026
0009ba3
FullStack README: a nullable column with a database default gets it o…
ejsmith Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FullStack's and Csla's labels come from one routine, NameWords.Label,…
… so they agree: an acronym is in capitals (IsVip: VIP, SKU, ID), a bool's label leaves out its Is, Desc stays Desc (a sort's direction as often as a description), and Csla spells out what FullStack did (Ship address 1, not Ship addr 1)
  • Loading branch information
ejsmith committed Nov 26, 2026
commit f780a4f44b696d37b2851d3c2e546edfec909bba
16 changes: 3 additions & 13 deletions Templates/Frameworks/Csla/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,9 @@ public static string Parameter(ColumnSchema column)
/// <summary>Arguments for columns: "orderId, lineNum".</summary>
public static string Arguments(IEnumerable<ColumnSchema> columns) => string.Join(", ", columns.Select(Parameter));

/// <summary>A property's display name: its words (ShipAddr1: "Ship addr 1", UniqueID: "Unique ID"; listprice too:
/// "List price", NameWords.cs).</summary>
public static string Friendly(ColumnSchema column)
{
var words = Regex.Split(NameWords.Property(column), "(?<=[a-z])(?=[A-Z0-9])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[0-9])(?=[A-Za-z])")
.Where(w => w.Length > 0).ToList();
for (int i = 0; i < words.Count; i++)
if (words[i] == "Id")
words[i] = "ID";
else if (i > 0 && words[i].Any(char.IsLower))
words[i] = words[i].ToLowerInvariant();
return string.Join(" ", words);
}
/// <summary>A property's display name: its words, as FullStack labels it (NameWords.Label: ShipAddr1 is "Ship
/// address 1", UniqueID "Unique ID", IsVip "VIP"; listprice too: "List price").</summary>
public static string Friendly(ColumnSchema column) => NameWords.Label(column);

/// <summary>A property's attributes: its display name, and the rules its column gives (Required, StringLength,
/// Range for a decimal's precision). CSLA makes rules of them.</summary>
Expand Down
46 changes: 45 additions & 1 deletion Templates/Frameworks/Csla/NameWords.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// keeps them (PRODUCTID): there's no capital or underscore to split them at. The words come from the schema itself
// (its tables' names, its other names' parts where they have case, its columns of one word) and a few common ones
// (id, name, date, price...). A name is split into the longest of them: productid is Product ID, listprice List price.
// A name with case of its own (ProductId) or underscores (product_id) keeps its words. The Csla and FullStack samples
// A name with case of its own (ProductId) or underscores (product_id) keeps its words. Label puts a name's words in
// sentence case for people (Ship address 1, Product ID, VIP), the same in both samples: the Csla and FullStack samples
// have the same copy of this file.
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -53,6 +54,49 @@ public static string Pascal(string name, DatabaseSchema database)
/// <summary>A column's property for its label: its name's words (productid: ProductId), else Names.Property's.</summary>
public static string Property(ColumnSchema column) => Pascal(column.Name, column.Table.Database) ?? Names.Property(column);

// ---- labels ----

// words a name shortens, spelled out (not desc: it's as often a sort's direction as a description)
private static readonly Dictionary<string, string> Spelled = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["descn"] = "description", ["addr"] = "address", ["qty"] = "quantity", ["num"] = "number", ["amt"] = "amount",
};

// words that are acronyms, in capitals
private static readonly HashSet<string> Acronyms = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"id", "ids", "url", "uri", "ip", "pin", "sku", "vip", "guid", "uuid", "api", "utc", "json", "xml", "html", "csv", "pdf", "sms", "ssn", "isbn",
};

/// <summary>A name in words, in sentence case, its acronyms in capitals: ShipAddr1 is "Ship address 1", ProductId
/// "Product ID", IsVip "Is VIP". The Csla and FullStack samples label with it.</summary>
public static string Label(string name)
{
var words = Regex.Split(name ?? "", "(?<=[a-z])(?=[A-Z0-9])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[0-9])(?=[A-Za-z])|[_\\s]+")
.Where(w => w.Length > 0).ToList();
for (int i = 0; i < words.Count; i++)
{
if (Acronyms.Contains(words[i]))
words[i] = words[i].ToLowerInvariant() == "ids" ? "IDs" : words[i].ToUpperInvariant();
else if (Spelled.TryGetValue(words[i], out string spelled))
words[i] = spelled;
else if (i > 0 && words[i].Any(char.IsLower))
words[i] = words[i].ToLowerInvariant();
}
string text = string.Join(" ", words);
return text.Length == 0 ? name : char.ToUpperInvariant(text[0]) + text.Substring(1);
}

/// <summary>A column's label: its name's words (listprice too: List price); a bool's without its Is or Has
/// (IsVip: VIP, HasStock: Stock).</summary>
public static string Label(ColumnSchema column)
{
string property = Property(column);
if (Names.Type(column).TrimEnd('?') == "bool" && Regex.IsMatch(property, "^(Is|Has)[A-Z0-9]"))
property = property.Substring(property.StartsWith("Is", StringComparison.Ordinal) ? 2 : 3);
return Label(property);
}

/// <summary>A table's entity for its labels: its name's words, singular (lineitem: LineItem), else Names.Entity's.</summary>
public static string Entity(TableSchema table)
{
Expand Down
46 changes: 45 additions & 1 deletion Templates/Web/FullStack/NameWords.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// keeps them (PRODUCTID): there's no capital or underscore to split them at. The words come from the schema itself
// (its tables' names, its other names' parts where they have case, its columns of one word) and a few common ones
// (id, name, date, price...). A name is split into the longest of them: productid is Product ID, listprice List price.
// A name with case of its own (ProductId) or underscores (product_id) keeps its words. The Csla and FullStack samples
// A name with case of its own (ProductId) or underscores (product_id) keeps its words. Label puts a name's words in
// sentence case for people (Ship address 1, Product ID, VIP), the same in both samples: the Csla and FullStack samples
// have the same copy of this file.
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -53,6 +54,49 @@ public static string Pascal(string name, DatabaseSchema database)
/// <summary>A column's property for its label: its name's words (productid: ProductId), else Names.Property's.</summary>
public static string Property(ColumnSchema column) => Pascal(column.Name, column.Table.Database) ?? Names.Property(column);

// ---- labels ----

// words a name shortens, spelled out (not desc: it's as often a sort's direction as a description)
private static readonly Dictionary<string, string> Spelled = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["descn"] = "description", ["addr"] = "address", ["qty"] = "quantity", ["num"] = "number", ["amt"] = "amount",
};

// words that are acronyms, in capitals
private static readonly HashSet<string> Acronyms = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"id", "ids", "url", "uri", "ip", "pin", "sku", "vip", "guid", "uuid", "api", "utc", "json", "xml", "html", "csv", "pdf", "sms", "ssn", "isbn",
};

/// <summary>A name in words, in sentence case, its acronyms in capitals: ShipAddr1 is "Ship address 1", ProductId
/// "Product ID", IsVip "Is VIP". The Csla and FullStack samples label with it.</summary>
public static string Label(string name)
{
var words = Regex.Split(name ?? "", "(?<=[a-z])(?=[A-Z0-9])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[0-9])(?=[A-Za-z])|[_\\s]+")
.Where(w => w.Length > 0).ToList();
for (int i = 0; i < words.Count; i++)
{
if (Acronyms.Contains(words[i]))
words[i] = words[i].ToLowerInvariant() == "ids" ? "IDs" : words[i].ToUpperInvariant();
else if (Spelled.TryGetValue(words[i], out string spelled))
words[i] = spelled;
else if (i > 0 && words[i].Any(char.IsLower))
words[i] = words[i].ToLowerInvariant();
}
string text = string.Join(" ", words);
return text.Length == 0 ? name : char.ToUpperInvariant(text[0]) + text.Substring(1);
}

/// <summary>A column's label: its name's words (listprice too: List price); a bool's without its Is or Has
/// (IsVip: VIP, HasStock: Stock).</summary>
public static string Label(ColumnSchema column)
{
string property = Property(column);
if (Names.Type(column).TrimEnd('?') == "bool" && Regex.IsMatch(property, "^(Is|Has)[A-Z0-9]"))
property = property.Substring(property.StartsWith("Is", StringComparison.Ordinal) ? 2 : 3);
return Label(property);
}

/// <summary>A table's entity for its labels: its name's words, singular (lineitem: LineItem), else Names.Entity's.</summary>
public static string Entity(TableSchema table)
{
Expand Down