SemanticTypeModel.DotNet
6.0.0
dotnet add package SemanticTypeModel.DotNet --version 6.0.0
NuGet\Install-Package SemanticTypeModel.DotNet -Version 6.0.0
<PackageReference Include="SemanticTypeModel.DotNet" Version="6.0.0" />
<PackageVersion Include="SemanticTypeModel.DotNet" Version="6.0.0" />
<PackageReference Include="SemanticTypeModel.DotNet" />
paket add SemanticTypeModel.DotNet --version 6.0.0
#r "nuget: SemanticTypeModel.DotNet, 6.0.0"
#:package SemanticTypeModel.DotNet@6.0.0
#addin nuget:?package=SemanticTypeModel.DotNet&version=6.0.0
#tool nuget:?package=SemanticTypeModel.DotNet&version=6.0.0
SemanticTypeModel Package Suite
This README is shared by all SemanticTypeModel.* NuGet packages because the packages are designed, versioned,
and tested as one tightly coupled suite.
Version alignment
Use the same exact version for every SemanticTypeModel.* package in your application. Mixing SemanticTypeModel
package versions is unsupported.
Generator/analyzer packages are part of that rule too. The compile-time semantic manifest requires exact producer/consumer suite-version alignment. The current ephemeral manifest schema is v3 and is not a persisted interchange format.
Choose packages by scenario
| Scenario | Packages |
|---|---|
| Define semantic annotations | SemanticTypeModel.DotNet |
| Generate the canonical model at compile time | SemanticTypeModel.Generators |
| JSON Schema | SemanticTypeModel.JsonSchema |
| EF Core | SemanticTypeModel.EFCore, SemanticTypeModel.EFCore.Generators |
| System.Text.Json | SemanticTypeModel.SystemTextJson |
| Power BI local metadata | SemanticTypeModel.PowerBI |
| Runtime DI composition | SemanticTypeModel.DependencyInjection |
| Deterministic semantic test data | SemanticTypeModel.TestData |
SemanticTypeModel.Abstractions and SemanticTypeModel.Core provide shared model/runtime contracts used by the
suite. Applications normally start from the scenario packages rather than selecting internal package layers
first.
Minimal model
using SemanticTypeModel.DotNet;
[SemanticType(SemanticTypeRole.Entity)]
[SemanticMutable]
public sealed class Customer
{
[SemanticKey]
[SemanticLogicalType("CustomerId")]
[SemanticImmutable]
public required Guid Id { get; init; }
public required string Name { get; init; }
}
With SemanticTypeModel.Generators, build the project and consume the generated provider:
using SemanticTypeModel.Generated;
TypeSchemaModel model = AppSemanticTypeModel.Create();
Lifecycle mutability is optional. No mutability attribute means STM makes no lifecycle-mutability claim. Logical Type is optional property metadata over an ordinary scalar and is never inferred from CLR wrapper shape.
Configure
Common generator settings include:
- generated namespace/provider name;
- discovery mode and namespace filters;
- internal type/member inclusion;
- naming policy;
- key inference;
- technical-description requirements;
- System.Text.Json metadata import.
General relationship inference is not a current generator capability.
See the complete configuration reference.
Current 6.0 boundaries and capabilities
The 6.0 suite retains SemanticTypeRole.Configuration as projection-neutral meaning and retains
SemanticRequiredWhen; it does not include STM-owned Configuration/Options binding or registration. The
removed SemanticTypeModel.Configuration package and AddSemanticOptions<TOptions> API have no tombstone or
forwarding replacement.
Use [SemanticDisplayIdentity(Order = 0)] and [SemanticAccessPath("ByCustomerNumber")] for ordered,
projection-neutral recognition and locate/filter semantics. These annotations do not generate indexes, API
queries, UI behavior, Power BI behavior, or relationships.
CLR single-value wrappers are not automatically inferred as scalars by STM or its projections. Strong Scalar
canonical semantics and SemanticLiteralKind.StrongIdentifier are removed in the 6.0 boundary. Applications
that use strongly typed CLR IDs own their target-specific conversions/integration.
The STM-configured JSON Schema contract is bounded and one-way: supported output validates against the schema,
without a promise of bidirectional serializer/schema equivalence. Native scalar fidelity is preserved across the
projection suite: Binary uses Base64 JSON with schema contentEncoding: base64, System.Uri uses
uri-reference by default, and raw Json is not restricted to object values.
An ordinary scalar property may opt into a projection-neutral Logical Type name with
[SemanticLogicalType("CustomerId")]. The name is metadata only: it does not change CLR, JSON, EF, LINQ,
TestData, or Power BI representation. Names must be valid and same-name properties in one model must use the same
scalar type.
SemanticTypeModel.TestData provides deterministic constraint-aware semantic graph generation and the typed
model.TestData().Generate<T>() / GenerateMany<T>() facade. Random mode needs no terminology profile.
Optional model-bound Semantic Terminology Profiles provide synthetic property/Logical-Type candidates, while
programmatic generators can supply application-specific scalar values. Public CLR materialization uses supported
constructors and members and never infers scalar meaning from wrapper shapes. Invalid explicit custom candidates
and materialization failures are reported with TestData diagnostics; built-in regex synthesis remains unsupported.
JSON Schema semantic annotations
SemanticTypeModel.JsonSchema exports Draft 2020-12 and can preserve selected STM-only semantics under one
optional x-stm object:
role
aggregateRoot
mutability
technicalDescription
keys
unit
ui
logicalType (property metadata)
JSON Schema import and JSON Editor compatibility modes are not supported current APIs.
For System.Text.Json runtime integration, use JsonSerializerOptions.AddSemanticTypeModelJson(model). This
configures modeled semantic Entity polymorphism without requiring a generated serializer
context. Register all models before first serializer use; explicit application polymorphism contracts remain
unchanged.
EF Core application
SemanticTypeModel.EFCore.Generators emits composable IEntityTypeConfiguration<TEntity> implementations for
explicitly selected semantic models. Applications own DbContext composition and unrelated/manual entities.
The model assembly's semantic manifest is ephemeral compile-time transport. Model and EF generator packages must use the same exact SemanticTypeModel suite version.
Diagnose
If generation or projection fails:
- Troubleshooting — symptom-oriented fixes;
- Diagnostics — diagnostic IDs and fixes;
- target/capability guides below — target-specific limitations and policies.
Target and capability guides
- Using SemanticTypeModel
- Core semantics
- JSON Schema
- EF Core
- System.Text.Json
- Power BI
- Projection capabilities
- Constraint-aware test data
Package roles
| Package | Responsibility |
|---|---|
SemanticTypeModel.Abstractions |
Shared canonical model/runtime contracts |
SemanticTypeModel.Core |
Core semantics, transformations, diagnostics, inspection |
SemanticTypeModel.DotNet |
Attributes and Roslyn extraction contracts |
SemanticTypeModel.Generators |
Compile-time canonical model provider and semantic manifest generation |
SemanticTypeModel.JsonSchema |
JSON Schema derivation and Draft 2020-12 export |
SemanticTypeModel.EFCore |
EF relational inspection, selection contract, converters/comparers/helpers |
SemanticTypeModel.EFCore.Generators |
Generated composable IEntityTypeConfiguration<TEntity> application |
SemanticTypeModel.SystemTextJson |
Resolver metadata derivation/customization |
SemanticTypeModel.PowerBI |
Deterministic local analytical metadata projection |
SemanticTypeModel.DependencyInjection |
Runtime provider/projection service registration |
SemanticTypeModel.TestData |
Deterministic constraint-aware semantic test-data generation and terminology profiles |
The aligned release suite contains exactly these eleven packages. All eleven must be kept at the same exact
version: SemanticTypeModel.Abstractions, SemanticTypeModel.Core, SemanticTypeModel.JsonSchema,
SemanticTypeModel.DotNet, SemanticTypeModel.Generators, SemanticTypeModel.DependencyInjection,
SemanticTypeModel.PowerBI, SemanticTypeModel.EFCore, SemanticTypeModel.EFCore.Generators,
SemanticTypeModel.SystemTextJson, and SemanticTypeModel.TestData. SemanticTypeModel.Configuration is not
part of the suite.
Important boundaries
SemanticTypeModel defines semantic meaning and target projection defaults; applications own global target infrastructure composition.
For example:
- EF Core remains responsible for providers/migrations/database lifecycle; applications own their
DbContext, manual EF configuration, and target-specific relationships; - System.Text.Json serializer contexts remain application-owned;
- Power BI service publishing/authentication remains outside local metadata projection;
- JSON Schema is an export target, not a canonical authoring source.
See Compatibility for current breaking boundaries.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- SemanticTypeModel.Abstractions (>= 6.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SemanticTypeModel.DotNet:
| Package | Downloads |
|---|---|
|
SemanticTypeModel.Generators
Incremental source generator package for SemanticTypeModel compile-time extraction. |
|
|
SemanticTypeModel.SystemTextJson
System.Text.Json contract integration, annotations, extraction options, and runtime helpers for SemanticTypeModel. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 0 | 9/2/2026 |
| 5.0.1 | 42 | 9/1/2026 |
| 5.0.0 | 110 | 8/23/2026 |
| 4.0.1 | 114 | 8/18/2026 |
| 4.0.0 | 109 | 8/16/2026 |
| 2.6.0 | 125 | 8/4/2026 |
| 2.5.3 | 118 | 8/4/2026 |
| 2.5.1 | 117 | 8/4/2026 |
| 2.5.0 | 118 | 8/3/2026 |
| 2.4.6 | 116 | 8/3/2026 |
| 2.4.5 | 113 | 8/3/2026 |
| 2.4.4 | 127 | 8/2/2026 |
| 2.4.3 | 116 | 7/31/2026 |
| 2.4.2 | 116 | 7/31/2026 |
| 2.4.1 | 131 | 7/3/2026 |
| 2.4.0 | 128 | 7/2/2026 |
| 2.3.0 | 134 | 6/20/2026 |
| 2.2.0 | 147 | 6/16/2026 |
| 2.1.0 | 136 | 6/15/2026 |
| 2.0.0 | 128 | 6/7/2026 |