コード例 #1
0
        /// <summary>
        /// Execute a Delete statement using the specified where clause
        /// </summary>
        /// <param name="where">the where statement action</param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public async Task <int> DeleteAllAsync <T>(Action <TypedWhereStatement <T> > where)
        {
            var s = new TypedDeleteStatement <T>(DialectProvider);

            where (s);
            return(await this.ExecuteScalarAsync <int>(DialectProvider.ToDeleteStatement(s.Statement)));
        }
コード例 #2
0
        /// <summary>
        /// Delete a single object using the <see cref="PrimaryKeyAttribute"/> to identify the record
        /// </summary>
        /// <param name="obj">The object to delete</param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public async Task <int> DeleteAsync <T>(T obj)
        {
            var s = new TypedDeleteStatement <T>(DialectProvider);

            s.AddPrimaryKeyWhereCondition(obj);

            return(await this.ExecuteScalarAsync <int>(DialectProvider.ToDeleteStatement(s.Statement)));
        }