[Ironpython-users] Using Autofac with IronPython

Piotr Nestorow Piotr.Nestorow at systemverification.com
Tue Dec 18 14:36:45 CET 2012


Hi

Is it possible to use Autofac in IronPython scripts?
More exactly: Is it possible to use Autofac to find and register component types in an assembly and then use the components in the Python script?

Example code:


import clr

clr.AddReference('Autofac')

import System

import Autofac

clr.ImportExtensions(Autofac)

from Autofac import ContainerBuilder

builder = ContainerBuilder()

builder.RegisterAssemblyTypes(System.Reflection.Assembly.Load("Some.Assembly"))

container = builder.Build()

# some object

o = container.Resolve[ISomeInterface]()

o.SomeMethod()





Any comments, examples, etc. ?



Regards

Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20121218/4b7b0dcd/attachment.html>


More information about the Ironpython-users mailing list