当前位置: 首页>>代码示例>>C#>>正文


C# Interfaces.esDataRequest类代码示例

本文整理汇总了C#中EntitySpaces.Interfaces.esDataRequest的典型用法代码示例。如果您正苦于以下问题:C# esDataRequest类的具体用法?C# esDataRequest怎么用?C# esDataRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


esDataRequest类属于EntitySpaces.Interfaces命名空间,在下文中一共展示了esDataRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFromStatement

        protected static string GetFromStatement(esDataRequest request, esDynamicQuerySerializable query, VistaDBCommand cmd, ref int pindex)
        {
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            string sql = String.Empty;

            if (iQuery.InternalFromQuery == null)
            {
                sql = Shared.CreateFullName(query);

                if (iQuery.JoinAlias != " ")
                {
                    sql += " " + iQuery.JoinAlias;
                }
            }
            else
            {
                IDynamicQuerySerializableInternal iSubQuery = iQuery.InternalFromQuery as IDynamicQuerySerializableInternal;

                iSubQuery.IsInSubQuery = true;

                sql += "(";
                sql += BuildQuery(request, iQuery.InternalFromQuery, cmd, ref pindex);
                sql += ")";

                if (iSubQuery.SubQueryAlias != " ")
                {
                    sql += " AS " + iSubQuery.SubQueryAlias;
                }

                iSubQuery.IsInSubQuery = false;
            }

            return sql;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:35,代码来源:QueryBuilder.cs

示例2: esSaveDataTable

        /// <summary>
        /// Used to issue a Save command on an esEntity or esEntityCollection.
        /// </summary>
        /// <param name="request">Contains all of the information necessary to issue and carry out the request</param>
        /// <param name="sig">Contains the required information to locate the EntitySpaces DataProvider</param>
        /// <returns></returns>
        public esDataResponse esSaveDataTable(esDataRequest request, esProviderSignature sig)
        {
            request.DatabaseVersion = sig.DatabaseVersion;
            esDataResponse response = esProviderFactory.GetDataProvider(sig.DataProviderName, sig.DataProviderClass).esSaveDataTable(request);

            // NOTE: New to 1.6.0. We do not rethrow the exception here, we do rethrow it in 
            // esEntityCollection.SaveToProviderInsertsUpdates after we assign the errors to the proper rows.

            return response;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:16,代码来源:esDataProvider.cs

示例3: PrepareCommand

        public static VistaDBCommand PrepareCommand(esDataRequest request)
        {
            esDynamicQuerySerializable query = request.DynamicQuery;
            VistaDBCommand cmd = new VistaDBCommand();

            int pindex = NextParamIndex(cmd);

            string sql = BuildQuery(request, query, cmd, ref pindex);

            cmd.CommandText = sql;
            return cmd;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:12,代码来源:QueryBuilder.cs

示例4: esLoadDataTable

        /// <summary>
        /// Used to populate an esEntity or esEntityCollection with data.
        /// </summary>
        /// <param name="request">Contains all of the information necessary to issue and carry out the request</param>
        /// <param name="sig">Contains the required information to locate the EntitySpaces DataProvider</param>
        /// <returns></returns>
        public esDataResponse esLoadDataTable(esDataRequest request, esProviderSignature sig)
        {
            request.DatabaseVersion = sig.DatabaseVersion;
            esDataResponse response = esProviderFactory.GetDataProvider(sig.DataProviderName, sig.DataProviderClass).esLoadDataTable(request);
            if(request.DynamicQuery != null)
            {
                request.DynamicQuery.es.LastQuery = response.LastQuery;
            }

            if (response.IsException)
            {
                throw response.Exception;
            }

            return response;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:22,代码来源:esDataProvider.cs

示例5: ExecuteNonQuery

        /// <summary>
        /// Used to execute a non-data return query through the EntitySpaces DataProvider
        /// </summary>
        /// <param name="request">Contains all of the information necessary to issue and carry out the request</param>
        /// <param name="sig">Contains the required information to locate the EntitySpaces DataProvider</param>
        /// <returns></returns>
        public esDataResponse ExecuteNonQuery(esDataRequest request, esProviderSignature sig)
        {
            request.DatabaseVersion = sig.DatabaseVersion;
            esDataResponse response = esProviderFactory.GetDataProvider(sig.DataProviderName, sig.DataProviderClass).ExecuteNonQuery(request);

            if (response.IsException)
            {
                throw response.Exception;
            }

            if (response.Parameters != null && response.Parameters.Count > 0)
            {
                request.Parameters.Merge(response.Parameters);
            }

            return response;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:23,代码来源:esDataProvider.cs

示例6: BuildQuery

        protected static string BuildQuery(esDataRequest request, esDynamicQuerySerializable query, VistaDBCommand cmd, ref int pindex)
        {
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            string select = GetSelectStatement(request, query, cmd, ref pindex);
            string from = GetFromStatement(request, query, cmd, ref pindex);
            string join = GetJoinStatement(request, query, cmd, ref pindex);
            string where = GetComparisonStatement(request, query, iQuery.InternalWhereItems, " WHERE ", cmd, ref pindex);
            string groupBy = GetGroupByStatement(request, query, cmd, ref pindex);
            string having = GetComparisonStatement(request, query, iQuery.InternalHavingItems, " HAVING ", cmd, ref pindex);
            string orderBy = GetOrderByStatement(request, query, cmd, ref pindex);
            string setOperation = GetSetOperationStatement(request, query, cmd, ref pindex);

            string sql = String.Empty;

            sql += "SELECT " + select + " FROM " + from + join + where + setOperation + groupBy + having + orderBy;

            return sql;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:19,代码来源:QueryBuilder.cs

示例7: esTraceArguments

            public esTraceArguments(esDataRequest request, IDbCommand cmd, string action, string callStack)
            {
                PacketOrder = Interlocked.Increment(ref esTraceArguments.packetOrder);

                this.command = cmd;

                TraceChannel = DataProvider.sTraceChannel;
                Syntax = "ORACLE";
                Request = request;
                ThreadId = Thread.CurrentThread.ManagedThreadId;
                Action = action;
                CallStack = callStack;
                SqlCommand = cmd;
                ApplicationName = System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);

                IDataParameterCollection parameters = cmd.Parameters;

                if (parameters.Count > 0)
                {
                    Parameters = new List<ITraceParameter>(parameters.Count);

                    for (int i = 0; i < parameters.Count; i++)
                    {
                        OracleParameter param = parameters[i] as OracleParameter;

                        esTraceParameter p = new esTraceParameter()
                        {
                            Name = param.ParameterName,
                            Direction = param.Direction.ToString(),
                            ParamType = param.OracleType.ToString().ToUpper(),
                            BeforeValue = param.Value != null ? Convert.ToString(param.Value) : "null"
                        };

                        this.Parameters.Add(p);
                    }
                }

                stopwatch = Stopwatch.StartNew();
            }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:39,代码来源:DataProvider.cs

示例8: esDataResponse

        esDataResponse IDataProvider.ExecuteReader(esDataRequest request)
        {
            esDataResponse response = new esDataResponse();
            SACommand cmd = null;

            try
            {
                cmd = new SACommand();
                if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
                if (request.Parameters != null) Shared.AddParameters(cmd, request);

                switch (request.QueryType)
                {
                    case esQueryType.TableDirect:
                        cmd.CommandType = CommandType.TableDirect;
                        cmd.CommandText = request.QueryText;
                        break;

                    case esQueryType.StoredProcedure:
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.CommandText = Shared.CreateFullName(request);
                        break;

                    case esQueryType.Text:
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = request.QueryText;
                        break;

                    case esQueryType.DynamicQuery:
                        cmd = QueryBuilder.PrepareCommand(request);
                        break;
                }

                cmd.Connection = new SAConnection(request.ConnectionString);
                cmd.Connection.Open();

                #region Profiling

                if (sTraceHandler != null)
                {
                    using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "ExecuteReader", System.Environment.StackTrace))
                    {
                        try
                        {
                            response.DataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                        }
                        catch (Exception ex)
                        {
                            esTrace.Exception = ex.Message;
                            throw;
                        }
                    }
                }
                else

                #endregion Profiling

                {
                    response.DataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                }
            }
            catch (Exception ex)
            {
                CleanupCommand(cmd);
                response.Exception = ex;
            }

            return response;
        }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:69,代码来源:DataProvider.cs

示例9: esTraceArguments

            public esTraceArguments(esDataRequest request, IDbCommand cmd, esEntitySavePacket packet, string action, string callStack)
            {
                PacketOrder = Interlocked.Increment(ref esTraceArguments.packetOrder);

                this.command = cmd;

                TraceChannel = DataProvider.sTraceChannel;
                Syntax = "SYBASE";
                Request = request;
                ThreadId = Thread.CurrentThread.ManagedThreadId;
                Action = action;
                CallStack = callStack;
                SqlCommand = cmd;
                ApplicationName = System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);

                IDataParameterCollection parameters = cmd.Parameters;

                if (parameters.Count > 0)
                {
                    Parameters = new List<ITraceParameter>(parameters.Count);

                    for (int i = 0; i < parameters.Count; i++)
                    {
                        SAParameter param = parameters[i] as SAParameter;

                        esTraceParameter p = new esTraceParameter()
                        {
                            Name = param.ParameterName,
                            Direction = param.Direction.ToString(),
                            ParamType = param.SADbType.ToString().ToUpper(),
                            BeforeValue = param.Value != null && param.Value != DBNull.Value ? Convert.ToString(param.Value) : "null"
                        };

                        try
                        {
                            // Let's make it look like we're using parameters for the profiler
                            if (param.Value == null || param.Value == DBNull.Value)
                            {
                                if (param.SourceVersion == DataRowVersion.Current)
                                {
                                    object o = packet.CurrentValues[param.SourceColumn];
                                    if (o != null && o != DBNull.Value)
                                    {
                                        p.BeforeValue = Convert.ToString(o);
                                    }
                                }
                                else if (param.SourceVersion == DataRowVersion.Original)
                                {
                                    object o = packet.OriginalValues[param.SourceColumn];
                                    if (o != null && o != DBNull.Value)
                                    {
                                        p.BeforeValue = Convert.ToString(o);
                                    }
                                }
                            }
                        }
                        catch { }

                        this.Parameters.Add(p);
                    }
                }

                stopwatch = Stopwatch.StartNew();
            }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:64,代码来源:DataProvider.cs

示例10: SetOriginalValues

        private static void SetOriginalValues(esDataRequest request, esEntitySavePacket packet, DataRow row, bool primaryKeysAndConcurrencyOnly)
        {
            foreach (esColumnMetadata col in request.Columns)
            {
                if (primaryKeysAndConcurrencyOnly &&
                    (!col.IsInPrimaryKey && !col.IsConcurrency && !col.IsEntitySpacesConcurrency)) continue;

                string columnName = col.Name;

                if (packet.OriginalValues.ContainsKey(columnName))
                {
                    row[columnName] = packet.OriginalValues[columnName];
                }
            }
        }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:15,代码来源:DataProvider.cs

示例11: SetModifiedValues

 private static void SetModifiedValues(esDataRequest request, esEntitySavePacket packet, DataRow row)
 {
     foreach (string column in packet.ModifiedColumns)
     {
         if (request.Columns.FindByColumnName(column) != null)
         {
             row[column] = packet.CurrentValues[column];
         }
     }
 }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:10,代码来源:DataProvider.cs

示例12: LoadDataSetFromStoredProcedure

        static private esDataResponse LoadDataSetFromStoredProcedure(esDataRequest request)
        {
            esDataResponse response = new esDataResponse();
            SqlCeCommand cmd = null;

            try
            {
                DataSet dataSet = new DataSet();

                cmd = new SqlCeCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = Shared.CreateFullName(request);

                if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
                if (request.Parameters != null) Shared.AddParameters(cmd, request);

                SqlCeDataAdapter da = new SqlCeDataAdapter();
                da.SelectCommand = cmd;

                try
                {
                    esTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);

                    #region Profiling
                    if (sTraceHandler != null)
                    {
                        using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadFromStoredProcedure", System.Environment.StackTrace))
                        {
                            try
                            {
                                da.Fill(dataSet);
                            }
                            catch (Exception ex)
                            {
                                esTrace.Exception = ex.Message;
                                throw;
                            }
                        }
                    }
                    else
                    #endregion
                    {
                        da.Fill(dataSet);
                    }
                }
                finally
                {
                    esTransactionScope.DeEnlist(da.SelectCommand);
                }

                response.DataSet = dataSet;

                if (request.Parameters != null)
                {
                    Shared.GatherReturnParameters(cmd, request, response);
                }
            }
            catch (Exception ex)
            {
                CleanupCommand(cmd);
                throw ex;
            }
            finally
            {

            }

            return response;
        }
开发者ID:stacyjeptha,项目名称:EntitySpaces-Architecture,代码行数:69,代码来源:DataProvider.cs

示例13: LoadDataTableFromText

        private static esDataResponse LoadDataTableFromText(esDataRequest request)
        {
            esDataResponse response = new esDataResponse();
            SACommand cmd = null;

            try
            {
                DataTable dataTable = new DataTable(request.ProviderMetadata.Destination);

                cmd = new SACommand();
                cmd.CommandType = CommandType.Text;
                if (request.CommandTimeout != null) cmd.CommandTimeout = request.CommandTimeout.Value;
                if (request.Parameters != null) Shared.AddParameters(cmd, request);

                SADataAdapter da = new SADataAdapter();
                cmd.CommandText = request.QueryText;
                da.SelectCommand = cmd;

                try
                {
                    esTransactionScope.Enlist(da.SelectCommand, request.ConnectionString, CreateIDbConnectionDelegate);

                    #region Profiling

                    if (sTraceHandler != null)
                    {
                        using (esTraceArguments esTrace = new esTraceArguments(request, cmd, "LoadFromText", System.Environment.StackTrace))
                        {
                            try
                            {
                                da.Fill(dataTable);
                            }
                            catch (Exception ex)
                            {
                                esTrace.Exception = ex.Message;
                                throw;
                            }
                        }
                    }
                    else

                    #endregion Profiling

                    {
                        da.Fill(dataTable);
                    }
                }
                finally
                {
                    esTransactionScope.DeEnlist(da.SelectCommand);
                }

                response.Table = dataTable;

                if (request.Parameters != null)
                {
                    Shared.GatherReturnParameters(cmd, request, response);
                }
            }
            catch (Exception)
            {
                CleanupCommand(cmd);
                throw;
            }
            finally
            {
            }

            return response;
        }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:70,代码来源:DataProvider.cs

示例14: CreateDataTable

        private static DataTable CreateDataTable(esDataRequest request)
        {
            DataTable dataTable = new DataTable();
            DataColumnCollection dataColumns = dataTable.Columns;
            esColumnMetadataCollection cols = request.Columns;

            if (request.SelectedColumns == null)
            {
                esColumnMetadata col;
                for (int i = 0; i < cols.Count; i++)
                {
                    col = cols[i];
                    dataColumns.Add(new DataColumn(col.Name, col.Type));
                }
            }
            else
            {
                foreach (string col in request.SelectedColumns.Keys)
                {
                    dataColumns.Add(new DataColumn(col, cols[col].Type));
                }
            }

            return dataTable;
        }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:25,代码来源:DataProvider.cs

示例15: SaveDynamicEntity

        private static DataTable SaveDynamicEntity(esDataRequest request)
        {
            bool needToDelete = request.EntitySavePacket.RowState == esDataRowState.Deleted;

            DataTable dataTable = CreateDataTable(request);

            using (SADataAdapter da = new SADataAdapter())
            {
                da.AcceptChangesDuringUpdate = false;

                DataRow row = dataTable.NewRow();
                dataTable.Rows.Add(row);

                SACommand cmd = null;

                switch (request.EntitySavePacket.RowState)
                {
                    case esDataRowState.Added:
                        cmd = da.InsertCommand = Shared.BuildDynamicInsertCommand(request, request.EntitySavePacket.ModifiedColumns);
                        SetModifiedValues(request, request.EntitySavePacket, row);
                        break;

                    case esDataRowState.Modified:
                        cmd = da.UpdateCommand = Shared.BuildDynamicUpdateCommand(request, request.EntitySavePacket.ModifiedColumns);
                        SetOriginalValues(request, request.EntitySavePacket, row, false);
                        SetModifiedValues(request, request.EntitySavePacket, row);
                        row.AcceptChanges();
                        row.SetModified();
                        break;

                    case esDataRowState.Deleted:
                        cmd = da.DeleteCommand = Shared.BuildDynamicDeleteCommand(request, request.EntitySavePacket);
                        SetOriginalValues(request, request.EntitySavePacket, row, true);
                        row.AcceptChanges();
                        row.Delete();
                        break;
                }

                if (!needToDelete && request.Properties != null)
                {
                    request.Properties["esDataRequest"] = request;
                    request.Properties["esEntityData"] = request.EntitySavePacket;
                    dataTable.ExtendedProperties["props"] = request.Properties;
                }

                DataRow[] singleRow = new DataRow[1];
                singleRow[0] = row;

                try
                {
                    if (!request.IgnoreComputedColumns)
                    {
                        da.RowUpdated += new SARowUpdatedEventHandler(OnRowUpdated);
                    }

                    esTransactionScope.Enlist(cmd, request.ConnectionString, CreateIDbConnectionDelegate);

                    #region Profiling

                    if (sTraceHandler != null)
                    {
                        using (esTraceArguments esTrace = new esTraceArguments(request, cmd, request.EntitySavePacket, "SaveEntityDynamic", System.Environment.StackTrace))
                        {
                            try
                            {
                                da.Update(singleRow);
                            }
                            catch (Exception ex)
                            {
                                esTrace.Exception = ex.Message;
                                throw;
                            }
                        }
                    }
                    else

                    #endregion Profiling

                    {
                        da.Update(singleRow);
                    }
                }
                finally
                {
                    esTransactionScope.DeEnlist(cmd);
                }
            }

            return dataTable;
        }
开发者ID:jssgarcia,项目名称:ESLite,代码行数:90,代码来源:DataProvider.cs


注:本文中的EntitySpaces.Interfaces.esDataRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。