Skip to content

Commit 69c0602

Browse files
committed
- update documentation
1 parent 16504cd commit 69c0602

9 files changed

Lines changed: 59 additions & 59 deletions

docs/advanced.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Mark a field with `[Encrypted]` to have values automatically encrypted before
66
INSERT/UPDATE and decrypted after SELECT.
77

88
```csharp
9-
public class SecureData : IdentDataObject
9+
public class SecureData : IdentityRecord
1010
{
1111
[Column("SSN")]
1212
[Encrypted(typeof(AesEncryption), EncryptionMethodType.AllDataEncrypted)]
@@ -48,9 +48,9 @@ Implement `IDBFieldMapper` to handle non-standard CLR ↔ DB type conversions:
4848
```csharp
4949
public class JsonMapper : IDBFieldMapper
5050
{
51-
private DataObject _container;
51+
private Record _container;
5252

53-
public void SetContainingDataObject(DataObject obj) => _container = obj;
53+
public void SetContainingDataObject(Record obj) => _container = obj;
5454

5555
public object ConvertToDBValue(object value)
5656
=> value is MyStruct s ? System.Text.Json.JsonSerializer.Serialize(s) : null;
@@ -85,12 +85,12 @@ Pass `AppFactory` to the connection constructor.
8585

8686
## Lookup Objects
8787

88-
`LookupDataObject` is a base class for reference / code-table entities whose rows are
88+
`LookupRecord` is a base class for reference / code-table entities whose rows are
8989
cached in memory after the first load.
9090

9191
```csharp
9292
[Table("Statuses")]
93-
public class Status : LookupDataObject
93+
public class Status : LookupRecord
9494
{
9595
[Column("Code")] public TString Code = new TString();
9696
[Column("Label")] public TString Label = new TString();
@@ -102,7 +102,7 @@ public class Status : LookupDataObject
102102
}
103103
```
104104

105-
When the ORM resolves a foreign-key relationship to a `LookupDataObject`, it reads from
105+
When the ORM resolves a foreign-key relationship to a `LookupRecord`, it reads from
106106
the in-memory cache rather than issuing a JOIN, reducing round trips for high-read
107107
reference tables.
108108

@@ -131,13 +131,13 @@ Similarly: `QueueForUpdate()`, `QueueForDelete()`.
131131
var result = conn.ExecStoredProcedure(
132132
template, "usp_GetProductsByCategory",
133133
0 /*start*/, 0 /*count (0=all)*/,
134-
new DataObject.SPInputParameter("@CategoryID", 2));
134+
new Record.SPInputParameter("@CategoryID", 2));
135135
```
136136

137137
## Raw SQL
138138

139139
```csharp
140-
// Returns an ObjectCollection populated from the query
140+
// Returns an RecordCollection populated from the query
141141
var results = conn.ExecSQL(template,
142142
"SELECT * FROM Products WHERE CreatedAt > @since",
143143
new Dictionary<string, object> { { "@since", DateTime.Today.AddDays(-7) } });

docs/di-service-proxies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class OrderService : IOrderService, IService
9696
_conn.Read(order);
9797

9898
order.Status.SetValue("Shipped");
99-
order.Update(DataObjectLock.UpdateOption.IgnoreLock);
99+
order.Update(RecordLock.UpdateOption.IgnoreLock);
100100
shipment.OrderID.SetValue(orderId);
101101
shipment.Insert();
102102
// Connection opened before this method; transaction commits here on success.
@@ -356,7 +356,7 @@ ActiveForgeServiceLocator.SetProvider(app.Services);
356356
With.Transaction(() =>
357357
{
358358
order.Status.SetValue("Shipped");
359-
order.Update(DataObjectLock.UpdateOption.IgnoreLock);
359+
order.Update(RecordLock.UpdateOption.IgnoreLock);
360360
});
361361
```
362362

docs/field-subsets.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Console.WriteLine(p.Price); // populated
7474
Console.WriteLine(p.Description); // IsNull() == true — was not fetched
7575
7676
// QueryAll with subset
77-
ObjectCollection results = conn.QueryAll(template, term, sort, 0, nameAndPrice);
77+
RecordCollection results = conn.QueryAll(template, term, sort, 0, nameAndPrice);
7878

7979
// QueryFirst with subset
8080
conn.QueryFirst(template, term, sort, nameAndPrice);
@@ -113,15 +113,15 @@ conn.ProcessActionQueue();
113113

114114
## Field Subsets on Embedded (Joined) Objects
115115

116-
When a `DataObject` embeds another `DataObject` as a field (joined table), you can
116+
When a `Record` embeds another `Record` as a field (joined table), you can
117117
include or exclude the entire embedded object's fields:
118118

119119
```csharp
120120
// Include all fields of the embedded Category object
121121
FieldSubset withCategory = conn.FieldSubset(
122122
rootObject: product,
123123
enclosing: product,
124-
enclosed: product.Category // a nested DataObject
124+
enclosed: product.Category // a nested Record
125125
);
126126

127127
// Or exclude it to skip the JOIN entirely

docs/getting-started.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ If consuming published NuGet packages:
6464

6565
## Concepts
6666

67-
### DataObject — the Active Record base
67+
### Record — the Active Record base
6868

69-
Every database entity extends `DataObject` (or `IdentDataObject` for auto-increment PK tables).
69+
Every database entity extends `Record` (or `IdentityRecord` for auto-increment PK tables).
7070
Fields are declared as **public fields** of a `TField` subtype — not properties.
7171

7272
```csharp
7373
[Table("Customers")]
74-
public class Customer : IdentDataObject
74+
public class Customer : IdentityRecord
7575
{
7676
[Column("FirstName")] public TString FirstName = new TString();
7777
[Column("LastName")] public TString LastName = new TString();
@@ -86,7 +86,7 @@ public class Customer : IdentDataObject
8686

8787
The `[Table]` attribute names the SQL table.
8888
The `[Column]` attribute names the SQL column.
89-
`IdentDataObject` adds an `ID` field (`TPrimaryKey`) with `[Identity]` — auto-populated after INSERT.
89+
`IdentityRecord` adds an `ID` field (`TPrimaryKey`) with `[Identity]` — auto-populated after INSERT.
9090

9191
### TField — null-aware typed wrapper
9292

@@ -156,7 +156,7 @@ if (found)
156156

157157
```csharp
158158
c.Balance.SetValue(250m);
159-
c.Update(DataObjectLock.UpdateOption.IgnoreLock);
159+
c.Update(RecordLock.UpdateOption.IgnoreLock);
160160

161161
// To update all fields unconditionally:
162162
c.UpdateAll();
@@ -165,7 +165,7 @@ c.UpdateAll();
165165
c.UpdateChanged();
166166
```
167167

168-
`DataObjectLock.UpdateOption` values:
168+
`RecordLock.UpdateOption` values:
169169
- `ReleaseLock` — release the optimistic lock after update
170170
- `RetainLock` — keep the lock (for subsequent updates in same transaction)
171171
- `IgnoreLock` — skip all locking (simplest, use for non-concurrent tables)
@@ -221,7 +221,7 @@ public class CustomerRepository
221221
return c.Read() ? c : null;
222222
}
223223

224-
public ObjectCollection GetActive()
224+
public RecordCollection GetActive()
225225
{
226226
var template = new Customer(_conn);
227227
var term = new EqualTerm(template, template.Active, true);
@@ -231,7 +231,7 @@ public class CustomerRepository
231231
public void Save(Customer c)
232232
{
233233
if (c.ID.IsNull()) c.Insert();
234-
else c.Update(DataObjectLock.UpdateOption.IgnoreLock);
234+
else c.Update(RecordLock.UpdateOption.IgnoreLock);
235235
}
236236

237237
public void Delete(Customer c) => c.Delete();

docs/joins.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document covers how ActiveForge ORM handles SQL JOINs — both the automati
77
## Overview
88

99
ActiveForge ORM derives JOIN SQL from the **structure of your entity class**, not from a query builder.
10-
When you embed a `DataObject` field inside another `DataObject`, the ORM automatically emits a JOIN between the two tables when you query the outer type.
10+
When you embed a `Record` field inside another `Record`, the ORM automatically emits a JOIN between the two tables when you query the outer type.
1111

1212
There are three layers of JOIN control:
1313

@@ -23,7 +23,7 @@ There are three layers of JOIN control:
2323

2424
If your entity class has:
2525
- a `TForeignKey` field named `XID` (e.g. `CategoryID`)
26-
- a `DataObject` field named `X` (e.g. `Category`) whose class name ends in `X`
26+
- a `Record` field named `X` (e.g. `Category`) whose class name ends in `X`
2727

2828
the ORM automatically produces:
2929

@@ -35,7 +35,7 @@ No attribute required.
3535

3636
```csharp
3737
[Table("Products")]
38-
public class ProductWithCategory : IdentDataObject
38+
public class ProductWithCategory : IdentityRecord
3939
{
4040
[Column("Name")] public TString Name = new TString();
4141
[Column("Price")] public TDecimal Price = new TDecimal();
@@ -65,7 +65,7 @@ Use `[JoinSpec]` to override the join type or specify non-standard column names.
6565
```csharp
6666
[Table("Products")]
6767
[JoinSpec("CategoryID", "Category", "ID", JoinSpecAttribute.JoinTypeEnum.LeftOuterJoin)]
68-
public class ProductWithOptionalCategory : IdentDataObject
68+
public class ProductWithOptionalCategory : IdentityRecord
6969
{
7070
[Column("Name")] public TString Name = new TString();
7171
[Column("Price")] public TDecimal Price = new TDecimal();
@@ -89,7 +89,7 @@ var results = conn.QueryAll(new ProductWithOptionalCategory(conn), null, null, 0
8989
```csharp
9090
[JoinSpec(
9191
sourceField: "CategoryID", // FK column on the outer table
92-
targetField: "Category", // embedded DataObject field name
92+
targetField: "Category", // embedded Record field name
9393
joinField: "ID", // PK column on the inner table
9494
joinType: JoinSpecAttribute.JoinTypeEnum.LeftOuterJoin)]
9595
```
@@ -98,11 +98,11 @@ var results = conn.QueryAll(new ProductWithOptionalCategory(conn), null, null, 0
9898

9999
## 3. Multiple FK Joins
100100

101-
Embed multiple `DataObject` fields to produce multiple JOINs in one query.
101+
Embed multiple `Record` fields to produce multiple JOINs in one query.
102102

103103
```csharp
104104
[Table("OrderLines")]
105-
public class OrderLineWithDetails : IdentDataObject
105+
public class OrderLineWithDetails : IdentityRecord
106106
{
107107
[Column("OrderID")] public TForeignKey OrderID = new TForeignKey();
108108
[Column("ProductID")] public TForeignKey ProductID = new TForeignKey();
@@ -128,7 +128,7 @@ var lines = conn.QueryAll(new OrderLineWithDetails(conn), null, null, 0, null);
128128

129129
## 4. Filtering on Joined Columns (QueryTerm API)
130130

131-
Pass the **embedded DataObject** (not the root template) as the `target` argument when building a `QueryTerm` against a joined column:
131+
Pass the **embedded Record** (not the root template) as the `target` argument when building a `QueryTerm` against a joined column:
132132

133133
```csharp
134134
var template = new ProductWithCategory(conn);
@@ -144,7 +144,7 @@ var both = conn.QueryAll(template, term & inStock, null, 0, null);
144144
// WHERE Categories.Name = 'Books' AND Products.InStock = 1
145145
```
146146

147-
> **Note**: The first `EqualTerm` argument must be the _containing_ `DataObject` instance
147+
> **Note**: The first `EqualTerm` argument must be the _containing_ `Record` instance
148148
> (the embedded field's owner), not the root query template.
149149
> For top-level fields, pass the root template; for joined fields, pass the embedded object.
150150
@@ -159,12 +159,12 @@ When using the LINQ query layer (`conn.Query<T>()`), you can:
159159

160160
### 5.1 Cross-Join `Where` Predicates
161161

162-
Navigate to the embedded DataObject field in your lambda — the ORM resolves the correct table column automatically:
162+
Navigate to the embedded Record field in your lambda — the ORM resolves the correct table column automatically:
163163

164164
```csharp
165165
using ActiveForge.Linq;
166166

167-
// Filter on a joined column — x.Category.Name navigates the embedded DataObject
167+
// Filter on a joined column — x.Category.Name navigates the embedded Record
168168
var books = conn.Query<ProductWithCategory>()
169169
.Where(x => x.Category.Name == "Books")
170170
.ToList();
@@ -275,7 +275,7 @@ var orders = conn.QueryAll(orderTemplate, existsTerm, null, 0, null);
275275

276276
| Limitation | Notes |
277277
|------------|-------|
278-
| No `JOIN` between unrelated tables | Joins must be expressed via embedded `DataObject` fields |
278+
| No `JOIN` between unrelated tables | Joins must be expressed via embedded `Record` fields |
279279
| No self-joins | A type cannot embed itself |
280280
| No many-to-many navigation | Bridge-table entities with two FKs can model this |
281281
| LINQ `Where` LHS must be a `TField` | `x.Category.SomeField` — works; arbitrary expressions — not supported |

docs/linq-querying.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ var items = conn.Query<Product>()
4343
```csharp
4444
// DataConnectionExtensions (ActiveForge.Linq namespace)
4545
public static OrmQueryable<T> Query<T>(this DataConnection connection)
46-
where T : DataObject;
46+
where T : Record;
4747

4848
// Overload with pre-constructed template (useful with custom factories or join queries)
4949
public static OrmQueryable<T> Query<T>(this DataConnection connection, T template)
50-
where T : DataObject;
50+
where T : Record;
5151
```
5252

5353
Internally, `Query<T>()` creates a template instance (`conn.Create(typeof(T))`), wraps it in an `OrmQueryable<T>`, and returns it.
@@ -222,12 +222,12 @@ foreach (var product in products)
222222

223223
## Querying Across Joins
224224

225-
When your entity embeds another `DataObject` (triggering a JOIN), LINQ predicates and sort selectors can navigate into the joined type directly.
225+
When your entity embeds another `Record` (triggering a JOIN), LINQ predicates and sort selectors can navigate into the joined type directly.
226226

227227
### Cross-Join `Where` Predicates
228228

229229
```csharp
230-
// x.Category.Name navigates the embedded DataObject → maps to Categories.Name
230+
// x.Category.Name navigates the embedded Record → maps to Categories.Name
231231
conn.Query(new ProductWithCategory(conn))
232232
.Where(x => x.Category.Name == "Books")
233233
.ToList();
@@ -290,14 +290,14 @@ OrmQueryable<Product> orm = (OrmQueryable<Product>)q;
290290
QueryTerm combined = orm.WhereTerm & new EqualTerm(product, product.Category, "Electronics");
291291

292292
// Execute using the classic API:
293-
ObjectCollection results = conn.QueryAll(product, combined, null, 0, null);
293+
RecordCollection results = conn.QueryAll(product, combined, null, 0, null);
294294
```
295295

296296
---
297297

298298
## How It Works
299299

300-
1. `conn.Query<T>()` creates an `OrmQueryable<T>` wrapping a template `DataObject` instance.
300+
1. `conn.Query<T>()` creates an `OrmQueryable<T>` wrapping a template `Record` instance.
301301
2. Each LINQ operator (`.Where(...)`, `.OrderBy(...)`, etc.) calls `IQueryProvider.CreateQuery()` on `OrmQueryProvider<T>`.
302302
3. `OrmQueryProvider<T>` recursively walks the expression tree, translating each operator into ORM state (WhereTerm, SortOrder, PageSize, SkipCount).
303303
4. When you enumerate (`ToList()`, `foreach`, etc.), `OrmQueryable<T>.GetEnumerator()` calls `conn.LazyQueryAll<T>(...)` or `conn.QueryPage(...)` with the accumulated state.
@@ -311,8 +311,8 @@ The expression tree is traversed **at execution time**, so local variables are c
311311
| Limitation | Notes |
312312
|------------|-------|
313313
| No `GroupBy` | Not supported; use raw SQL or `ExecSQL`. |
314-
| No `Join` clause | Cross-join predicates and sorts work via embedded `DataObject` fields. See [joins.md](joins.md). |
315-
| No `Select` projection | Returns full typed `DataObject` instances; field subsets can be applied at the `conn.Query<T>(template)` level. |
314+
| No `Join` clause | Cross-join predicates and sorts work via embedded `Record` fields. See [joins.md](joins.md). |
315+
| No `Select` projection | Returns full typed `Record` instances; field subsets can be applied at the `conn.Query<T>(template)` level. |
316316
| No `Count()`, `First()`, etc. | Call the standard ORM methods (`conn.QueryCount(...)`, `conn.QueryFirst(...)`) directly. |
317317
| No async support | Use the synchronous API; async is planned for a future release. |
318318

docs/provider-appendix.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ Metadata about a single mapped field. Populated by `DBDataConnection.PopulateSQL
924924
```csharp
925925
public class TargetFieldInfo
926926
{
927-
public FieldInfo FieldInfo; // Reflection handle to the TField field on the DataObject
927+
public FieldInfo FieldInfo; // Reflection handle to the TField field on the Record
928928
public string FieldName; // C# field name (e.g. "Name")
929929
public string TargetName; // DB column name (e.g. "ProductName")
930930
public string SourceName; // DB table alias / source name (e.g. "Products")
@@ -1004,7 +1004,7 @@ Created by `OrmQueryable<T>.InnerJoin<TJoined>()` / `.LeftOuterJoin<TJoined>()`.
10041004
```csharp
10051005
public readonly struct JoinOverride
10061006
{
1007-
public readonly Type TargetType; // which embedded DataObject type to override
1007+
public readonly Type TargetType; // which embedded Record type to override
10081008
public readonly JoinSpecification.JoinTypeEnum JoinType; // the replacement join type
10091009
10101010
public JoinOverride(Type targetType, JoinSpecification.JoinTypeEnum joinType);
@@ -1154,7 +1154,7 @@ Use this checklist when building a new provider.
11541154
- [ ] Identity assignment — verify the identity field is populated after INSERT
11551155
- [ ] Query terms — `EqualTerm`, `LikeTerm`, `GreaterThanTerm`, `ContainsTerm` (IN clause)
11561156
- [ ] Pagination — `QueryPage` with non-zero `start`
1157-
- [ ] JOIN queries — inner join, left outer join via `QueryAll` with embedded `DataObject`
1157+
- [ ] JOIN queries — inner join, left outer join via `QueryAll` with embedded `Record`
11581158
- [ ] Transactions — commit path, rollback path, nested UoW depth
11591159
- [ ] `IUnitOfWork` depth counter — outer commit only commits at depth 0
11601160
- [ ] LINQ layer — `conn.Query<T>().Where(...).OrderBy(...).Take(...).Skip(...).ToList()`

0 commit comments

Comments
 (0)