/// <summary> /// Perform an SQL INSERT, and then retrieve a generated identifier. /// </summary> /// <returns> the id of the collection entry </returns> /// <remarks> /// This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc). /// </remarks> protected Task <object> PerformInsertAsync(object ownerId, IPersistentCollection collection, object entry, int index, ISessionImplementor session, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return(Task.FromCanceled <object>(cancellationToken)); } IBinder binder = new GeneratedIdentifierBinder(ownerId, collection, entry, index, session, this); return(identityDelegate.PerformInsertAsync(SqlInsertRowString, session, binder, cancellationToken)); }
/// <summary> /// Perform an SQL INSERT, and then retrieve a generated identifier. /// </summary> /// <remarks> /// This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc). /// </remarks> protected object Insert(object[] fields, bool[] notNull, SqlCommandInfo sql, object obj, ISessionImplementor session) { if (log.IsDebugEnabled) { log.Debug("Inserting entity: " + EntityName + " (native id)"); if (IsVersioned) { log.Debug("Version: " + Versioning.GetVersion(fields, this)); } } IBinder binder = new GeneratedIdentifierBinder(fields, notNull, session, obj, this); return identityDelegate.PerformInsert(sql, session, binder); }
/// <summary> /// Perform an SQL INSERT, and then retrieve a generated identifier. /// </summary> /// <returns> the id of the collection entry </returns> /// <remarks> /// This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc). /// </remarks> protected object PerformInsert(object ownerId, IPersistentCollection collection, object entry, int index, ISessionImplementor session) { IBinder binder = new GeneratedIdentifierBinder(ownerId, collection, entry, index, session, this); return identityDelegate.PerformInsert(SqlInsertRowString, session, binder); }