Class DataExtensions
public static class DataExtensions
- Inheritance
-
DataExtensions
Methods
RetrieveIdentity<T>(IEnumerable<T>, DataConnection, bool, bool)
Initializes source columns, marked with IsIdentity or IdentityAttribute with identity values:
- if column had sequence name set using SequenceNameAttribute and
useSequenceName
set totrue
, values from sequence used. Implemented for: Oracle, PostgreSQL - if table has identity configured and
useIdentity
set totrue
, values from sequence used. Implemented for: SQL Server 2005+ - Otherwise column initialized with values, incremented by 1 starting with max value from database for this column plus 1.
public static IEnumerable<T> RetrieveIdentity<T>(this IEnumerable<T> source, DataConnection context, bool useSequenceName = true, bool useIdentity = false) where T : notnull
Parameters
source
IEnumerable<T>Ordered list of entities to initialize.
context
DataConnectionData connection to use to retrieve sequence values of max used value for column.
useSequenceName
boolEnables identity values retrieval from sequence for columns with sequence name specified in mapping using SequenceNameAttribute. Implemented for Oracle and PostgreSQL.
useIdentity
boolEnables identity values retrieval from table with identity column. Implemented for SQL Server 2005+.
Returns
- IEnumerable<T>
Returns new collection of identity fields initialized or
source
if entity had no identity columns.
Type Parameters
T
Entity type.