本文整理汇总了C#中IKernel.HasModule方法的典型用法代码示例。如果您正苦于以下问题:C# IKernel.HasModule方法的具体用法?C# IKernel.HasModule怎么用?C# IKernel.HasModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKernel
的用法示例。
在下文中一共展示了IKernel.HasModule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
// Find all assemblies that have ninject modules and load them if NONE from the assembly have already been loaded
// Note: this means that if a single module has been loaded directly, all others in that assembly will also have
// to be loaded in the same manner if they are to be used in this application
foreach (
var a in
AppDomain.CurrentDomain.GetAssemblies()
.Where(r => r.FullName.ToLower().StartsWith("revolutionsounds")))
{
if (a.GetTypes().Any(m => typeof (NinjectModule).IsAssignableFrom(m)) &&
!a.GetTypes().Any(m => typeof (NinjectModule).IsAssignableFrom(m) && kernel.HasModule(m.FullName)))
{
kernel.Load(a);
}
}
}
示例2: EnsureFactoryExtensionLoaded
public static void EnsureFactoryExtensionLoaded(IKernel kernel)
{
if (!kernel.HasModule(typeof (Ninject.Extensions.Factory.FuncModule).FullName))
kernel.Load(new[] {typeof (Ninject.Extensions.Factory.FuncModule).Assembly});
}