Example #1
0
        public int Execute()
        {
            SqlCommand command = connection.GetCommand(commandText);

            DatabaseTrace.Append(command.CommandText, Constant.Query);

            if (connection.HasTransaction)
            {
                command.Transaction = connection.Transaction;
            }

            return(command.ExecuteNonQuery());
        }
Example #2
0
        public T[] ToArray <T>()
        {
            T[] callback;

            using (SqlCommand command = connection.GetCommand(commandText))
            {
                DatabaseTrace.Append(command.CommandText, Constant.Query);

                if (connection.HasTransaction)
                {
                    command.Transaction = connection.Transaction;
                }

                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.Default))
                {
                    callback = DatabaseReaderSelect <T> .ToArray(reader);

                    reader.Close();
                }
            }

            return(callback);
        }
Example #3
0
        public void Fill(EntitySet <TEntity> EntitySet)
        {
            if (EntitySet.Context.ContextType != typeof(TEntityContext))
            {
                throw new EntityDatabaseException($"{this}, Write Failed, {EntitySet} Context Must Be Type Of {typeof(TEntityContext)}");
            }

            using (SqlCommand command = connection.GetCommand(commandText))
            {
                DatabaseTrace.Append(command.CommandText, Constant.Query);

                if (connection.HasTransaction)
                {
                    command.Transaction = connection.Transaction;
                }

                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.Default))
                {
                    EntityDatabaseReaderSelect <TEntityContext, TEntity, TEntityCallBack> .Fill(reader, EntitySet);

                    reader.Close();
                }
            }
        }