コード例 #1
0
 /// <summary>
 ///     Updates or inserts an entity and returns true if successful.
 /// </summary>
 /// <typeparam name="T">The type of entity to update or insert.</typeparam>
 /// <param name="entityToUpsert">The Entity to update or insert.</param>
 /// <param name="columnsToUpdate">The columns to update if the record exists.</param>
 /// <param name="insertAction">A callback function before the record is inserted.</param>
 /// <param name="updateAction">A callback function before the record is updated.</param>
 /// <returns>
 ///     True if the record is updated or inserted.
 /// </returns>
 public bool Upsert <T>(T entityToUpsert, IEnumerable <string> columnsToUpdate, Action <T> insertAction,
                        Action <T> updateAction) where T : class => ExecuteInternal(() => SharedConnection.Upsert(entityToUpsert,
                                                                                                                  columnsToUpdate, insertAction, updateAction, _transaction, OneTimeCommandTimeout ?? CommandTimeout));
コード例 #2
0
 /// <summary>
 ///     Updates or inserts an entity and returns true if successful.
 /// </summary>
 /// <typeparam name="T">The type of entity to update or insert.</typeparam>
 /// <param name="entityToUpsert">The Entity to update or insert.</param>
 /// <returns>
 ///     True if the record is updated or inserted.
 /// </returns>
 public bool Upsert <T>(T entityToUpsert) where T : class => ExecuteInternal(() =>
                                                                             SharedConnection.Upsert(entityToUpsert, _transaction, OneTimeCommandTimeout ?? CommandTimeout));