문제

I'm working on a MonoDroid app, and there really isn't a good DI solution yet (at least that I know of).

I've gotten PostSharp to work on MonoDroid, and I'm using the Location Intercept aspect as a way to inject dependencies into fields/properties without using a service locator (outside of the aspect anyway).

Here's what I'm working with so far: https://github.com/mgroves/MonodroidStockPortfolio/blob/develop/MonoStockPortfolio/Framework/IoCAttribute.cs

It's rough, and definitely needs refactoring, but you get the idea from the basic structure. However, I'm not completely convinced that this approach is the best way. How would you go about using DI/IoC in a MonoDroid app, with or without PostSharp?

도움이 되었습니까?

해결책

It's more "classic container" rather than AOP, and MonoDroid isn't a platform I've tested it on (it's been tested on Mono, MonoTouch, Silverlight, Windows Mobile and WinPhone7 though), but TinyIoC should work if it fits the bill:

http://hg.grumpydev.com/tinyioc/wiki/Home

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top