コード例 #1
0
 public void AddExecuteableObject(IExecuteable execute)
 {
     if (_interactiveObjects == null)
     {
         _interactiveObjects = new[] { execute };
         return;
     }
     Array.Resize(ref _interactiveObjects, Length + 1);
     _interactiveObjects[Length - 1] = execute;
 }
コード例 #2
0
        public override Parameter Execute()
        {
            IExecuteable statement  = GetParam(0);
            IExecuteable statement2 = GetParam(2);
            IExecuteable statement3 = GetParam(3);
            int          i          = 0;

            for (statement.Execute(); (bool)GetParam(1); statement2.Execute())
            {
                i++;
                if (i >= 1000)
                {
                    HackStudioCode.Instance.Log("Stack over flow");
                    break;
                }
                statement3.Execute();
            }
            return(Parameter.Empty);
        }
コード例 #3
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <typeparam name="T">实体</typeparam>
 /// <param name="source">源</param>
 /// <param name="selector">数据源</param>
 /// <returns></returns>
 public static int Insert <T>(this IExecuteable <T> source, IQueryable <T> selector)
 => source.Provider.Execute(Expression.Call(null, GetMethodInfo(Insert, source, selector), new Expression[2] {
     source.Expression,
     selector.Expression
 }));
コード例 #4
0
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <typeparam name="T">实体</typeparam>
 /// <param name="source">源</param>
 /// <returns></returns>
 public static int Delete <T>(this IExecuteable <T> source, Expression <Func <T, bool> > expression)
 => source.Where(expression).Delete();
コード例 #5
0
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <typeparam name="T">实体</typeparam>
 /// <param name="source">源</param>
 /// <returns></returns>
 public static int Delete <T>(this IExecuteable <T> source)
 => source.Provider.Execute(Expression.Call(null, GetMethodInfo(Delete, source), new Expression[1] {
     source.Expression
 }));
コード例 #6
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <typeparam name="T">实体</typeparam>
 /// <param name="source">源</param>
 /// <param name="updater">更新的字段和值</param>
 /// <returns></returns>
 public static int Update <T>(this IExecuteable <T> source, Expression <Func <T, T> > updater)
 => source.Provider.Execute(Expression.Call(null, GetMethodInfo(Update, source, updater), new Expression[2] {
     source.Expression,
     Expression.Quote(updater)
 }));
コード例 #7
0
 /// <summary>
 /// 执行数据表
 /// </summary>
 /// <typeparam name="T">实体</typeparam>
 /// <param name="source">源</param>
 /// <param name="table">获取表名称的工厂</param>
 /// <returns></returns>
 public static IExecuteable <T> From <T>(this IExecuteable <T> source, Func <ITableRegions, string> table)
 => source.Provider.CreateExecute(Expression.Call(null, GetMethodInfo(From, source, table), new Expression[2] {
     source.Expression,
     Expression.Constant(table)
 }));
コード例 #8
0
 /// <summary>
 /// 执行条件
 /// </summary>
 /// <typeparam name="T">实体</typeparam>
 /// <param name="source">源</param>
 /// <param name="expression">条件表达式</param>
 /// <returns></returns>
 public static IExecuteable <T> Where <T>(this IExecuteable <T> source, Expression <Func <T, bool> > expression)
 => source.Provider.CreateExecute(Expression.Call(null, GetMethodInfo(Where, source, expression), new Expression[2] {
     source.Expression,
     Expression.Quote(expression)
 }));