title: How to resolve an object in Orchard CMS?
body: <p>I have a service class in a module in Orchard CMS that it is dependent on some dependency such as <code>IContentManager</code> and it implemented <code>IDependency</code> interface.
  in my controllers i used it by injecting and it works pretty good.</p>
  
  <p>my service:</p>
  
  <pre><code>public class AddressService : IAddressService
  {
      private readonly IContentManager _contentManager;
      private readonly IOrchardServices _orchardService;
      private readonly IRepository&lt;StatePartRecord&gt; _stateRepository;
      private readonly IContentDefinitionManager _contentDefinitionManager;
      public AddressService(IContentManager contentManager, IOrchardServices orchardService, IRepository&lt;StatePartRecord&gt; stateRepository, IContentDefinitionManager contentDefinitionManager)
      {
          _contentManager = contentManager;
          _orchardService = orchardService;
          _stateRepository = stateRepository;
          _contentDefinitionManager = contentDefinitionManager;
      }
  ...
  }
  
  public interface IAddressService : IDependency    { ... }
  </code></pre>
  
  <p>my question is that, in my custom class that is just a simple class how do i resolve and create an object instance of my service class in it?</p>
  
  <p>my simple class:</p>
  
  <pre><code>public class MyClass
  {
  
     public SomeMethod() 
     {
        var addressService = // a method to resolve 'AddressService' class from IOC container
  
        // Do somthing with 'addressService' ...
     }
  }
  </code></pre>
  
  <p><strong>Edit</strong> I already knew that we can use <code>AddressService</code> by injecting way, but i can't use injection in some cases such as <code>static classes</code> or <code>extension method</code>... ,Because of that i need to resolve dynamically <code>AddressService</code> and create instance by some method (that i guess it would be found in Orchard Framework) where i had to use it.</p>
  
  <p><strong>In fact I need a method that takes a Type as argument and create instance of the passed Type and return the created object.</strong></p>