# File lib/dm-core/model/property.rb, line 42
      def property(name, type, options = {})
        if TrueClass == type
          raise "#{type} is deprecated, use Boolean instead at #{caller[2]}"
        elsif BigDecimal == type
          raise "#{type} is deprecated, use Decimal instead at #{caller[2]}"
        end

        # if the type can be found within Property then
        # use that class rather than the primitive
        unless klass = DataMapper::Property.determine_class(type)
          raise ArgumentError, "+type+ was #{type.inspect}, which is not a supported type"
        end

        property = klass.new(self, name, options)

        repository_name = self.repository_name
        properties      = properties(repository_name)

        properties << property

        # Add property to the other mappings as well if this is for the default
        # repository.

        if repository_name == default_repository_name
          other_repository_properties = DataMapper::Ext::Hash.except(@properties, default_repository_name)

          other_repository_properties.each do |other_repository_name, properties|
            next if properties.named?(name)

            # make sure the property is created within the correct repository scope
            DataMapper.repository(other_repository_name) do
              properties << klass.new(self, name, options)
            end
          end
        end

        # Add the property to the lazy_loads set for this resources repository
        # only.
        # TODO Is this right or should we add the lazy contexts to all
        # repositories?
        if property.lazy?
          context = options.fetch(:lazy, :default)
          context = :default if context == true

          Array(context).each do |context|
            properties.lazy_context(context) << property
          end
        end

        # add the property to the child classes only if the property was
        # added after the child classes' properties have been copied from
        # the parent
        descendants.each do |descendant|
          descendant.properties(repository_name) << property
        end

        create_reader_for(property)
        create_writer_for(property)

        # FIXME: explicit return needed for YARD to parse this properly
        return property
      end