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
PLINQO: README.md describes the templates and the Metadata class (wha…
…t generating again keeps: each member as written, #if lines around its attributes, the file's indentation; what it doesn't) and links to the migration guide's framework templates in CI, in place of Readme.url, whose page is gone; the Legacy README says the generated code builds with the .NET SDK anywhere and runs on Windows
  • Loading branch information
ejsmith committed Nov 26, 2026
commit 05a94c220b7724a1fe804463e05a13454b7ac110
83 changes: 83 additions & 0 deletions Templates/Legacy/Frameworks/PLINQO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# PLINQO for LINQ to SQL

CodeSmith Generator 8.x's PLINQO templates, kept as they were (see [Legacy samples](../../README.md)). From a SQL Server
database they generate a LINQ to SQL data layer for .NET Framework 3.5 to 4.5: a `.dbml`, two files per entity, managers
and queries. They run in CodeSmith Generator 9.0 on Windows, Linux and macOS.

| Template | What it writes |
| --- | --- |
| `CSharp/Dbml.cst` (`VisualBasic/`) | The `.dbml` from the database. Your changes to it (names, associations) are kept. |
| `CSharp/Entities.cst` | From the `.dbml`: the data context, and for each entity `Product.Generated.cs` (written again every time) and `Product.cs` (yours; only its `Metadata` class is generated). |
| `CSharp/Managers.cst`, `CSharp/Queries.cst` | Managers and query extensions. |
| `QuickStart.cst` | 8.x's Visual Studio solution, with a project (`Common/QuickStartData.csp`) that runs the templates above. |

Run a project with `cs generate PetShop.Data.csp`, and check that the committed code is up to date with
`cs check PetShop.Data.csp`. To generate in CI (the connection string, Windows authentication, schema snapshots,
building the output on Linux), see
[framework templates in CI](https://github.com/codesmithtools/Generator/blob/master/Documentation/CrossPlatformCli/guides/moving-from-8x.md#framework-templates-plinqo-csla-nhibernate-in-ci).

## The Metadata class

`Product.cs` is yours: everything in it stays as you wrote it, except the `Metadata` class in its `#region Metadata`,
which Entities.cst writes again on every run. Its members are the entity's columns and associations, so the attributes
you put on them (validation, display, auditing) apply to the entity's properties:

```csharp
#nullable enable
namespace PetShop.Data;

public partial class Product
{
// Place custom code here.
public string Title => Name ?? ProductId;

#region Metadata
[CodeSmith.Data.Audit.Audit]
internal class Metadata
{
// WARNING: Only attributes inside of this class will be preserved.

[Required(ErrorMessage = $"{nameof(ProductId)} is required.")]
[StringLength(10, MinimumLength = 2)]
public string ProductId { get; init; } = "";

#if DEBUG
[UIHint("DebugName")]
#endif
[Display(Name = "Product name")] // shown in the grid
public string? Name { get; set; } = "";

public decimal? ListPrice { get; set; }

[ScaffoldColumn(false)]
public EntitySet<Item> ItemList { get; set; } = [];

}

#endregion
}
```

When it's generated again:
- A member you have is kept as you wrote it: its attributes (with any `#if`, `#elif`, `#else` and `#endif` lines around
them, and comments between them) and its declaration (`?`, `init`, `required`, `=>`, an initializer), so a file with
nullable annotations builds as it did. Its type isn't updated when the column's changes: the members are there for
their attributes, and their types don't matter.
- A new column or association gets a member as 8.x wrote it: `public string Status { get; set; }`, with `[Required]`,
`[DataType(...)]` or `[Now(...)]` where the column calls for one. In a file with `#nullable enable`, give it a `?` or
an initializer, or the compiler warns (CS8618); it's kept from then on.
- A member for a column or association that's gone is removed, and so is anything else in the class: put other code
outside it.
- The class is written at the indentation of the one it replaces, so a file with a file-scoped namespace, or one
`dotnet format` has formatted, stays as it is: `cs check` and `dotnet format` agree on it.
- An `#if` around a whole member, not only its attributes, isn't kept: put the attributes in the `#if` instead.
- Everything outside the class can be any C# (or VB) the compiler takes: file-scoped namespaces, records, `=>` members,
raw and interpolated strings.

8.x kept only the attributes, each on its own line, wrote every member as `public T Name { get; set; }`, and kept an
attribute inside `#if` without its `#if` lines (making a debug-only attribute unconditional).

In VB (`Product.vb`), the attributes are kept as written; each member is written as 8.x wrote it
(`Public Property Name() As Object`). VB doesn't allow `#If` between attributes and their member.

The generated files' comment points to `http://www.plinqo.com/metadata.ashx`, which is gone: this page replaces it.
2 changes: 0 additions & 2 deletions Templates/Legacy/Frameworks/PLINQO/Readme.url

This file was deleted.

13 changes: 9 additions & 4 deletions Templates/Legacy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@

CodeSmith Generator 8.x's framework templates and projects, kept as they were so that projects built on them still
generate. They run in CodeSmith Generator 9.0 on Windows, Linux and macOS, and write what 8.x wrote. What they
generate targets .NET Framework and Visual Studio 2010–2015 (and SQL Server, mostly), so it builds only there.
generate targets .NET Framework and Visual Studio 2010–2015 (and SQL Server, mostly): it runs on Windows, and builds
with the .NET SDK anywhere (see
[framework templates in CI](https://github.com/codesmithtools/Generator/blob/master/Documentation/CrossPlatformCli/guides/moving-from-8x.md#framework-templates-plinqo-csla-nhibernate-in-ci)).

| Folder | What it generates |
| --- | --- |
| `Frameworks/Csla` | CSLA .NET 3.8–4.5 business objects (C# and VB). |
| `Frameworks/PLINQO` | LINQ to SQL (PLINQO). |
| `Frameworks/PLINQO` | LINQ to SQL (PLINQO): see its [README](Frameworks/PLINQO/README.md). |
| `Frameworks/PLINQO-EF-DbContext` | Entity Framework 6 code first. |
| `Frameworks/PLINQO-NH` | NHibernate 3.2. |
| `Database/StoredProcedures` | T-SQL CRUD stored procedures. |
| `Projects` | 8.x's API sample (replaced by [Hosting](../Examples/Hosting/README.md)) and custom property editors (WinForms, replaced by [PropertyEditor](../Examples/PropertyEditor/README.md)), .NET Framework. |

They aren't changed any more. For new work, start from the samples outside this folder.
They get fixes, not new features. For new work, start from the samples outside this folder.

PLINQO's entity files (`Product.cs`, `Product.vb`: the partial class whose `Metadata` class keeps the attributes you add)
can use today's C# and VB: `=>` members, file-scoped namespaces, `init`, nullable annotations, and `nameof`,
interpolated and raw strings in the attributes; in VB, auto-implemented properties, attributes on their own line
without ` _`, and `NameOf`. Entities.cst copies each attribute as written. 8.x read these files as C# 3 and VB 9 only.
without ` _`, and `NameOf`. Entities.cst keeps each C# `Metadata` member as written (in VB, its attributes), with the
`#if` lines around its attributes, at the class's indentation: see
[PLINQO's README](Frameworks/PLINQO/README.md#the-metadata-class). 8.x read these files as C# 3 and VB 9 only, and kept
only the attributes.

`Database/StoredProcedures` writes what 8.x wrote, mistakes too: for a table whose last column is a `rowversion`
(`timestamp`), a procedure's parameters end with a comma before `AS`; a table whose columns are all its key gets an
Expand Down