Ninject和MonoDroid [英] Ninject and MonoDroid

查看:75
本文介绍了Ninject和MonoDroid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人有运气让Ninject从事MonoDroid吗?我已经从他们的网站上尝试了2.0和4.0 mono版本,还尝试了.net版本.

Anyone had any luck getting Ninject to work on MonoDroid? i've tried the 2.0 and 4.0 mono builds from their website and also tried the .net versions.

使用Mono版本时,我在我的StandardKernel实例化中遇到MissingMethodException

With the Mono builds i'm getting a MissingMethodException in the instantiation of my StandardKernel

推荐答案

我正在针对Android项目的WP7/Monotouch/Mono组合对Ninject进行实验,而Ninject的效果令人惊讶.

I am experimenting with Ninject on a combined WP7/Monotouch/Mono for Android project and Ninject works surprisingly good.

我使用了最新的资源,其中包含一个似乎已经过时的项目文件Ninject.WP7.csproj.它包含很多DefineConstants.我使用这些常量以及所有经过编译和运行的东西为Android解决方案创建了新的WP7/Monotouch/Mono!

I used the latest sources, which contain a project file Ninject.WP7.csproj which seems to be outdated. It contains a lot of DefineConstants. I created new WP7/Monotouch/Mono for Android solutions with these constants and everything compiled and works!

使用的常量:

SILVERLIGHT,SILVERLIGHT_40,NO_LCG,NO_ASSEMBLY_SCANNING,NO_WEB,NO_PARTIAL_TRUST,NO_SKIP_VISIBILITY,NO_EXCEPTION_SERIALIZATION,NO_DEBUG_SYMBOLS

不确定是否全部需要它们,但是SILVERLIGHT很重要,因为Android的Monotouch/Mono实现了Silverlight API的很大一部分.

not sure if they are all needed, but the SILVERLIGHT one is important because Monotouch/Mono for Android implement a large part of the Silverlight api.

当然,您不能使用Ninject创建Android活动.我主要将其用于构造函数注入,创建.Net对象(如ViewManager),使用存储库查看模型等,这是您使用依赖项注入时通常要做的事情.

Of course you cannot create Android Activities with Ninject. I use it mainly for constructor injection, to create .Net objects like a ViewManager, view models using a repository, etc., the usual things you do with dependency injection.

这篇关于Ninject和MonoDroid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆