开发者

AutoFac for Window Phone 7 - IContainter.Resolve extension method is not found

I'm building a fun application for Windows Phone 7. I'm using MVVM pattern and AutoFac for resolving the dependencies. I have got a classes AutoFacConfiguration holding a property as below

public static IContainer Container { get; private set; }

I try to resolve one of the registered types in some other part of the application like below

AutoFacConfiguration.Container.Resolve<IExpenseRepository>()

But this is not compiling. The compiler says Container does not ha开发者_C百科ve Resolve method. I know that IContainer derives from IComponentContext and an extension method with following signature does existing in the AutoFac assembly

public TService Resolve<TService>(this IComponentContext context)

Am I missing something here? I have just referenced the AutoFac.dll in my porject. This is downloaded from autofac site.


Have you added the relevant namespace as a using directive? For example, if the extension method is in class Foo.Bar.Baz, you should have:

using Foo.Bar;

in the source file that's trying to use the extension method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜