Skip to content
A DLR integration for Ninject
C# Ruby
Find file
Pull request Compare This branch is even with MiguelMadero:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
src
tools
.gitignore
Ninject.Dynamic.sln
README

README

This repository contains the ruby branch of Ninject.
The aim is to integrate the DLR as nicely as possible in a DI container.

If you're using Resharper for running unit tests you'll have to uncheck the box next to
Shadow-copies being tested in the unit testing section of the resharper options.

example:
to_configure_ninject do |ninject|
  ninject.bind IServiceA, :to => ServiceA, :as => :singleton, :meta => { :type => "superservice" }, :name => "aaaaa"
end

The typical use case would probably look like this:
to_configure_ninject do |ninject|
  ninject.bind IServiceA, :to => ServiceA, :as => :transient
  ninject.bind ISingletonService, :to => SingletonServiceImpl
end

All the configuration options:

to_configure_ninject do |ninject|
  ninject.bind IServiceA, :to => ServiceA, :as => :singleton,
    :meta => { :type => "superservice" },
    :name => "aaaaa",
    :parameter => { :my_param => lambda { |context| "param_value" } },
    :constructor_arguments => {:const_arg => 56 },
    :property_values => {:property_name => 94 },
    :on_activation => lambda { |obj| obj.do_some_work },
    :on_deativated => lambda { |obj| obj.do_some_cleanup },
    :when => {
      :provider => lambda { |context| "a value" },
      :injected_into => ServiceB,
      :target_has => AnAttribute,
      :member_has => AnAttribute,
      :class_has => AnAttribute
    }
end

Happy playing :)
Something went wrong with that request. Please try again.