- 增加 MySql 特有功能 Insert Ignore Into;

This commit is contained in:
28810
2019-11-19 12:14:56 +08:00
parent f7474c6e69
commit b338efc8a2
9 changed files with 84 additions and 189 deletions

View File

@ -1,5 +1,6 @@
using FreeSql;
using FreeSql.MySql.Curd;
using System;
public static partial class FreeSqlMySqlGlobalExtensions
{
@ -22,4 +23,17 @@ public static partial class FreeSqlMySqlGlobalExtensions
/// <returns></returns>
public static OnDuplicateKeyUpdate<T1> OnDuplicateKeyUpdate<T1>(this IInsert<T1> that) where T1 : class => new FreeSql.MySql.Curd.OnDuplicateKeyUpdate<T1>(that.InsertIdentity());
/// <summary>
/// MySql 特有的功能Insert Ignore Into
/// </summary>
/// <typeparam name="T1"></typeparam>
/// <param name="that"></param>
/// <returns></returns>
public static IInsert<T1> MySqlIgnoreInto<T1>(this IInsert<T1> that) where T1 : class
{
var _mysqlInsert = that as MySqlInsert<T1>;
if (_mysqlInsert == null) throw new Exception("MySqlIgnoreInto 是 FreeSql.Provider.MySql/FreeSql.Provider.MySqlConnector 特有的功能");
_mysqlInsert.InternalIsIgnoreInto = true;
return that;
}
}