EntityConnectionExtensions.ById<TRow> method (1 of 2)
namespace: Serenity.Data assembly: Serenity.Net.Entity
Finds an entity by its ID value. This method selects only the table fields, and no foreign / calculated fields. Use other overloads if you want to select different set of fields.
public static TRow ById<TRow>(this IDbConnection connection, object id)
where TRow : class, IRow, IIdRow, new()
parameter | description |
---|---|
TRow | The type of the row. |
connection | The connection. |
id | The identifier. |
Return Value
Entity with given ID
Exceptions
exception | condition |
---|---|
ValidationError | Record with specified ID is not found |
InvalidOperationException | Multiple records with the ID found |
See Also
- class TRow
- interface IRow
- interface IIdRow
- class EntityConnectionExtensions
EntityConnectionExtensions.ById<TRow> method (2 of 2)
namespace: Serenity.Data assembly: Serenity.Net.Entity
Finds an entity by its ID value. This method does not select any fields by default and allows you to edit the query to select fields you want.
public static TRow ById<TRow>(this IDbConnection connection, object id, Action<SqlQuery> editQuery)
where TRow : class, IRow, IIdRow, new()
parameter | description |
---|---|
TRow | The type of the row. |
connection | The connection. |
id | The identifier. |
editQuery | Callback to edit the query. |
Return Value
Entity with given ID
Exceptions
exception | condition |
---|---|
ValidationError | Record with specified ID is not found |
InvalidOperationException | Multiple records with the ID found |
See Also
- class TRow
- class SqlQuery
- interface IRow
- interface IIdRow
- class EntityConnectionExtensions