CRUDServiceBaseTEntity, TKey, TInput, TFilterRawExecuteInsertAsync Method

执行插入实体 Insert 语句的方法。

Definition

Namespace: QuickAdmin.Service.CRUD
Assembly: QuickAdmin.Net (in QuickAdmin.Net.dll) Version: 2.0.10
C#
protected virtual Task RawExecuteInsertAsync(
	TEntity entity,
	CancellationToken cancellationToken
)

Parameters

entity  TEntity
要插入的实体。此实体对象通常是由 TInput 映射而来的。
cancellationToken  CancellationToken
用于取消操作的令牌。

Return Value

Task

Remarks

方法内执行 Insert。
对于 IEntityWithAutoIdKey 类型实体以及 IEntityWithIdKey<int> 类型且标注了主键 IsIdentity=true 的实体, 执行 ExecuteIdentity() 并将返回值赋予实体 Id 属性。
对于其它类型实体,执行 ExecuteAffrows()

See Also