/// <summary> /// 更新父级Id实例事务时候新建索引。 /// </summary> /// <typeparam name="TParentIndex">索引类型。</typeparam> /// <param name="db">数据库事务操作接口实例。</param> /// <param name="id">当前实例Id。</param> /// <param name="parentId">父级Id。</param> /// <returns>返回添加结果。</returns> public static bool UpdateIndex <TParentIndex>(this IDbTransactionContext <TParentIndex> db, int id, int parentId) where TParentIndex : IParentIndex, new() { db.Delete(x => x.Id == id);//删除原有的父级ID return(db.CreateIndex(id, parentId)); }