币安量化交易
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
688 B

using FreeSql;
using System;
using System.Collections.Generic;
namespace Binance.TradeRobot.Business.Extensions
{
public static class FreeSqlExtension
{
public static ISelect<T1, T2, T3> WithLock<T1, T2, T3>(this ISelect<T1, T2, T3> that, SqlServerLock lockType = SqlServerLock.NoLock, Dictionary<Type, bool> rule = null) where T2 : class where T3 : class
{
return rule == null ?
that.AsAlias((type, old) => $"{old} With({lockType})") :
that.AsAlias((type, old) => rule.TryGetValue(type, out var trybool) && trybool ? $"{old} With({lockType.ToString()})" : old);
}
}
}