IoC with AOP (PostSharp) in MonoDroid

I am working on a MonoDroid application and there really is not a good DI solution yet (at least I know).

I got PostSharp to work with MonoDroid , and I use the aspect of location capture as a way of nesting dependencies in fields / properties without using a service locator (outside of every aspect).

Here is what I work so far: https://github.com/mgroves/MonodroidStockPortfolio/blob/develop/MonoStockPortfolio/Framework/IoCAttribute.cs

It's rude, and you definitely need refactoring, but you get the idea from the basic structure. However, I'm not quite sure that this approach is the best way. How could you use DI / IoC in a MonoDroid app, with or without PostSharp?

+4
source share
1 answer

This is a more “classic container”, not AOP, and MonoDroid is not the platform I tested it on (it was tested on Mono, MonoTouch, Silverlight, Windows Mobile and WinPhone7), but TinyIoC should work if it is suitable for counting :

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

+7
source

Source: https://habr.com/ru/post/1332790/


All Articles