Пример #1
0
        public SqlCommand GenerateSqlCommand()
        {
            if (QueryObject == null || QueryObject.GetQueryString().ExIsNullOrEmpty())
            {
                return(null);
            }

            var sqlCommand = new SqlCommand(QueryObject.GetQueryString())
            {
                CommandType    = QueryObject.GetCommandType(),
                CommandTimeout = Timeout
            };

            if (!QueryObject.GetParameters().IsListNullOrEmpty())
            {
                foreach (var sqlParameter in QueryObject.GetParameters())
                {
                    sqlCommand.Parameters.Add(sqlParameter);
                }
            }

            return(sqlCommand);
        }