コード例 #1
0
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
            var data     = dataStrategy.Find(table.GetQualifiedName(), criteria);

            return(CreateSimpleResultSet(table, dataStrategy, data));
        }
コード例 #2
0
ファイル: FindByCommand.cs プロジェクト: vbedegi/Simple.Data
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
            var data = dataStrategy.Find(table.GetQualifiedName(), criteriaExpression).FirstOrDefault();

            return(data != null ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy) : null);
        }
コード例 #3
0
 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
     var data = dataStrategy.Find(table.GetQualifiedName(), criteria);
     return new SimpleResultSet(data != null
                  ? data.Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy))
                  : Enumerable.Empty<SimpleRecord>());
 }
コード例 #4
0
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
            var data     = dataStrategy.Find(table.GetQualifiedName(), criteria);

            return(new SimpleResultSet(data != null
                         ? data.Where(dict => dict != null).Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy))
                         : Enumerable.Empty <SimpleRecord>()));
        }
コード例 #5
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database (or transaction)</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                var data = dataStrategy.Find(table.GetQualifiedName(), (SimpleExpression)args[0]).FirstOrDefault();
                return(data != null ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy) : null);
            }

            return(null);
        }
コード例 #6
0
ファイル: FindCommand.cs プロジェクト: robashton/Simple.Data
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database (or transaction)</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                var data = dataStrategy.Find(table.GetQualifiedName(), (SimpleExpression)args[0]).FirstOrDefault();
                return data != null ? new SimpleRecord(data, table.GetQualifiedName(), dataStrategy) : null;
            }

            return null;
        }
コード例 #7
0
ファイル: FindAllCommand.cs プロジェクト: fzawada/Simple.Data
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database or transaction</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                var data = dataStrategy.Find(table.GetQualifiedName(), (SimpleExpression)args[0]);
                return new SimpleResultSet(data != null
                             ? data.Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy))
                             : Enumerable.Empty<SimpleRecord>());
            }

            return null;
        }
コード例 #8
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="dataStrategy">The database or transaction</param>
        /// <param name="table"></param>
        /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
        /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
        /// <returns></returns>
        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            if (args.Length == 1 && args[0] is SimpleExpression)
            {
                var data = dataStrategy.Find(table.GetQualifiedName(), (SimpleExpression)args[0]);
                return(new SimpleResultSet(data != null
                             ? data.Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy))
                             : Enumerable.Empty <SimpleRecord>()));
            }

            return(null);
        }
コード例 #9
0
ファイル: AllCommand.cs プロジェクト: vbedegi/Simple.Data
 /// <summary>
 /// Executes the command.
 /// </summary>
 /// <param name="database">The database.</param>
 /// <param name="table"></param>
 /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
 /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
 /// <returns></returns>
 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     return(new SimpleResultSet(dataStrategy.Find(table.GetQualifiedName(), null)
                                .Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy))));
 }
コード例 #10
0
 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     var criteria = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), MethodNameParser.ParseFromBinder(binder, args));
     var data = dataStrategy.Find(table.GetQualifiedName(), criteria);
     return CreateSimpleResultSet(table, dataStrategy, data);
 }
コード例 #11
0
ファイル: AllCommand.cs プロジェクト: fzawada/Simple.Data
 /// <summary>
 /// Executes the command.
 /// </summary>
 /// <param name="database">The database.</param>
 /// <param name="table"></param>
 /// <param name="binder">The binder from the <see cref="DynamicTable"/> method invocation.</param>
 /// <param name="args">The arguments from the <see cref="DynamicTable"/> method invocation.</param>
 /// <returns></returns>
 public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
 {
     return new SimpleResultSet(dataStrategy.Find(table.GetQualifiedName(), null)
         .Select(dict => new SimpleRecord(dict, table.GetQualifiedName(), dataStrategy)));
 }