# File lib/dm-core/transaction.rb, line 42
    def link(*things)
      raise "Illegal state for link: #{@state}" unless @state == :none
      things.each do |thing|
        if thing.is_a?(Array)
          link(*thing)
        elsif thing.is_a?(DataMapper::Adapters::AbstractAdapter)
          @adapters[thing] = :none
        elsif thing.is_a?(DataMapper::Repository)
          link(thing.adapter)
        elsif thing.is_a?(Class) && thing.ancestors.include?(DataMapper::Resource)
          link(*thing.repositories)
        elsif thing.is_a?(DataMapper::Resource)
          link(thing.model)
        else
          raise "Unknown argument to #{self}#link: #{thing.inspect}"
        end
      end
      return commit { |*block_args| yield(*block_args) } if block_given?
      return self
    end