EntityConnectionExtensions class

namespace: Serenity.Data   assemblySerenity.Net.Entity

Contains extension methods to perform entity CRUD operations directly on connections. Please note that all these methods operate on a low level, and none of them call service behaviors or performs service validations.

public static class EntityConnectionExtensions

Public Members

name description
static ById<TRow>(…) 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. (2 methods)
static Count<TRow>(…) Gets count of all records. (2 methods)
static DeleteById<TRow>(…) Deletes the entity by its identifier. Note that this operates at a low level, it does not perform any validation or permission check and does not call service behaviors / handlers.
static Exists<TRow>(…) Checks if record matching specified criteria exists.
static ExistsById<TRow>(…) Checks if the record with specified ID exists.
static First<TRow>(…) Finds first entity matching a where criteria. (2 methods)
static Insert<TRow>(…) Inserts the specified entity. Note that this operates at a low level, it does not perform any validation or permission check, and does not call service behaviors / handlers.
static InsertAndGetID<TRow>(…) Inserts the specified entity and returns the ID of record inserted. Only works for identity columns of integer type. Note that this operates at a low level, it does not perform any validation or permission check and does not call service behaviors / handlers.
static List<TRow>(…) Lists all records. This method selects only the table fields, and no foreign / calculated fields. Use other overloads if you want to select different set of fields. (3 methods)
static Single<TRow>(…) Finds a single entity matching the specified criteria. This method selects only the table fields, and no foreign / calculated fields. Use other overloads if you want to select different set of fields. (2 methods)
static ToSqlInsert(…) Converts the entity to an SqlInsert object by setting only the assigned fields.
static ToSqlUpdateById(…) Converts the entity to an SqlUpdate object by ID setting only the assigned fields.
static TryById<TRow>(…) Tries to 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. (2 methods)
static TryFirst<TRow>(…) Tries to find first entity matching a where criteria. (2 methods)
static TrySingle<TRow>(…) Tries to find a single entity matching the specified criteria. This method selects only the table fields, and no foreign / calculated fields. Use other overloads if you want to select different set of fields. (2 methods)
static UpdateById<TRow>(…) Updates the entity by its identifier. Note that this operates at a low level, it does not perform any validation or permission check and does not call service behaviors / handlers.

See Also