Osy#betaa language · its runtime Osyrin · a hosted platform
Why Osy#Built for agentsAgents as declarationsWorkflows that waitRuns exactly onceSecure by defaultNothing to mockThe editor is the compilerUI in the languageDocuments are dataOne program

Reference

Query

23 pages.

Querying data

How you read data in Osy#. You write C# LINQ; it becomes one SQL statement. The rules that follow from that are the whole model: the predicate runs…

Child collections (navigating a relation)

A parent's child collection — `order.Lines` — is not a loaded array. It is a QUERY, correlated to that parent, and every LINQ verb works on it:…

Delete

Ends a query chain with a set-based DELETE: every row the chain selects is deleted in the database, immediately, in one statement — and the call…

Distinct

Removes duplicate rows from a query result. On whole entity rows it is a no-op, because rows are already unique by Id — it earns its keep on…

Dynamic IN (list.Contains in a query)

Filter a query by membership in a RUNTIME list — list.Contains(e.Column) inside a Where lowers to SQL `= ANY(@param)`, passing the whole list as one…

First / Single / Last / ElementAt

The terminals that return ONE row. They differ in what they promise, and choosing the wrong one is how a bug hides: `Single` asserts there is exactly…

GroupBy (and HAVING)

Group rows by a key and reduce each group to one row — `g.Key`, `g.Count()`, `g.Sum/Average/Min/Max(…)` — computed by the database as a real GROUP…

Include (pre-loading relations)

Pre-load the related rows a query's results are about to navigate to. `Include(o => o.Lines)` does not change what comes back — the same rows, the…

Insert

Ends a query chain by creating one row of ANOTHER entity per row the chain selects — an INSERT … SELECT in one statement. The chain is the source…

Join / LeftJoin / SelectMany

Combine two entities into one result. `Join` keeps the rows that match on both sides; `LeftJoin` keeps every row on the left and gives you null on…

LINQ over a local list

Query a local `List<T>`, `HashSet<T>` or `T[]` — of your own `class` values OR of plain scalars like `string[]` and `int[]` — with the same LINQ…

OrderBy / ThenBy

Sort a query by one key or several. `OrderBy`/`OrderByDescending` start the sort, `ThenBy`/`ThenByDescending` add further keys — and the keys…

Query<T>

Holds a query instead of its rows. A clause you write against a `Query<T>` joins the query rather than filtering rows already fetched, so a chain…

Select (projections)

Reshape what a query returns: one column, an anonymous row, or a `class` you declared. The projection becomes the SQL SELECT list, so the columns you…

Skip / Take (paging)

Page a query with Skip(n) (OFFSET) and Take(m) (LIMIT). The count can be a compile-time constant OR a runtime integer — a variable, parameter, or…

Sorting rows the client holds

A sequence the client already holds — a component's `T[]` rows parameter, a `List<T>` — sorts with `OrderBy` / `OrderByDescending`, and the key is…

Sum / Average / Min / Max / Count

Fold rows down to a single number — a query or a `List<T>` you already hold. The one thing to know before you use them: **Min/Max/Average answer null…

ToList

Runs the query and materialises the rows as a `List<Entity>`. Until you call it, a query is a description of what you want; ToList is the moment it…

Traverse (walking a graph)

Walk a relation recursively — an org chart up to its root, a category tree down to its leaves, a bill of materials, a reply thread — and get back…

Union / Concat / Intersect / Except

Combines two row-queries over the same entity with SQL set semantics: Union dedups, Concat keeps duplicates (UNION ALL), Intersect keeps rows present…

Update

Ends a query chain with a set-based UPDATE: every row the chain selects gets the assignments applied, in the database, immediately — and the call…

Where / Single / Count

Query an entity by writing a predicate over it. The query runs in the database — not a filter over rows you already fetched — so a table with…

Window

Ranking and neighbours inside a query's result. The indexed `Select((s, i) => …)` over an ordered chain is C#'s own spelling of a row number; the…