HiLang 2.1.0

dotnet add package HiLang --version 2.1.0                
NuGet\Install-Package HiLang -Version 2.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HiLang" Version="2.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HiLang --version 2.1.0                
#r "nuget: HiLang, 2.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HiLang as a Cake Addin
#addin nuget:?package=HiLang&version=2.1.0

// Install HiLang as a Cake Tool
#tool nuget:?package=HiLang&version=2.1.0                

HiLang

HiLang is a minimal high-level language to describe the schema of a domain, taking inspiration from protobuf (.proto models) for hierarchical structures and SQL DML for entities, relations and views.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 5 1/24/2025
2.0.0 44 1/14/2025
1.3.9 99 11/15/2024
1.3.0 99 10/5/2024
1.2.18 141 9/15/2024
1.2.16 122 9/7/2024
1.2.15 108 9/1/2024
1.2.11 91 8/6/2024
1.2.9 90 7/26/2024
1.2.8 119 7/19/2024
1.2.6 103 7/15/2024
1.2.4 120 7/4/2024
1.2.0 127 5/30/2024
1.1.37 112 5/11/2024
1.1.34 111 4/22/2024
1.1.30 119 3/24/2024
1.1.26 133 3/14/2024
1.1.23 133 2/26/2024
1.1.22 130 2/16/2024
1.1.21 175 1/11/2024
1.1.19 157 1/1/2024
1.1.17 145 12/23/2023
1.1.11 137 12/16/2023
1.1.10 143 12/6/2023
1.1.7 143 11/30/2023
1.1.5 131 11/21/2023
1.0.14-prerelease 154 8/6/2023

# Overview
This release introduced introduced two changes, to enhance error reporting when binding an element that fails a horizon filter, the second add functionality to simplify schema evolution.  In addition to changes to Hiperspace, packages references have been upgraded to the latest versions.

## Horizon Filters

Horizon filter provide a conditional view that divided a subspace with elements that are visible in the hiperspace, and those that are not (*over the horizon*).  This is great for reading from hiperspace because it allows elements that are not valid in the current context (*e.g. changes that have not been approved*) or the user does not have access. The Horizon filters are also applied when binding an element to hiperspace, since you should not be able to add anthing that you could not see.

Hiperspace horizon is contextual, to allow the same code to be used for initial seeding of data and logging errors for later analysis.  **This change** assists with validation by adding the option of an error message when the horizon is used for data validation.

`new Horizon<Element_Type> ( "element only", element => element.Valid == true)' a horizon predicate with the element only
`new Horizon<Element_Type> ( "element only", (element, read) => element.Valid == true || read)' a horizon predicate with a flag to indicate a read operation
`new Horizon<Element_Type> ( "element only", (element, context, read) => element.Valid == true || read)' a horizon predicate with a context parameter and a flag to indicate a read operation
`new Horizon<Element_Type> ( "element only",(element, context, user, read) => element.Valid == true || user?.IsInRole("BULK"))' a horizon predicate with a context parameter, user IPrinciple and a flag to indicate a read operation

## Auto-edit of #id alias in HiLang schema

If a #id is not added to the definition of an {element, key, value, extent, index} an id is auto allocated during the compilation of a **.hilang** file. It is best practice to add #id field to simplify the evolution of a schema since the internal #id can never be changed (*to a different data type*) or reused for a different purpose since it wil invalidate historic views of data.  This can be a problem when {element, key, value, extent, index} are dropped and the #id is then used for a later addition.  To simplify maintenance the directive `%ids;` has been added to optionally add the generated #id to the source file

the source `entity Customer (Id : Int32) {Name :String} [SameName = Customer(Name = Name];` defines an entity *Customer* with a key *Id* and value *Name* and an index *SameName* that can be used to find Customers **or** to apply horizon validation 'Horizon<Customer>("Duplicate Name", (customer, read) => customer.SameName == null || read).

When the `%ids;` directive is added, the the source is auto edited to `entity Customer #1 (Id : Int32 #1) {Name : String #2} [SameName = Customer(Name = Name) #2];` to indicate that Customer has #1 id and CustomerSameNameIndex has #2 (*stored items have unique #id, but SameName is not stored with customer, so does not need to be unique within the element*)

If we decide to break *Name* into *First_Name* and *Family_Name* we'd change the entity to
```
entity Customer #1 (Id : Int32 #1)
{First_Name : String #3, Family_Name : String #4}
[Name =  First_Name + " " + Family_Name, SameName #3 = Customer( Family_Name = Family_Name, First_Name = First_Name];
```
Adding `%ids;` directive simplifies the process of avoiding clashes that will prevent the hiperspace being opened with updated code.

### DeltaIndex
The `@DeltaIndex` property of an entity provides indexes access to elements that have changed since a date-time stamp.  The property has been updated to include the option to define the #id for the index by adding a parameter  `@DeltaIndex(4)`

### CubeFact
The `@CubeFact` property of an element creates a fact element (the code `@CubeFact entity Account` adds an additional *Account_Fact* table to the hiperspace for stored historic aggregates of @CubeMeasure values).
The property has been updated to include the #id of the fact table `@CubeFact(5)` indicates that the fact table has #id of 5.

`%ids;` is optional since #id's will be allocated (*during compilation*) for intermediate elements that will be pruned before generation resulting in gaps in the generated #id numbers