本文整理汇总了C#中IKernel类的典型用法代码示例。如果您正苦于以下问题:C# IKernel类的具体用法?C# IKernel怎么用?C# IKernel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IKernel类属于命名空间,在下文中一共展示了IKernel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContentProviders
private static IList<IContentProvider> GetContentProviders(IKernel kernel)
{
// Use MEF to locate the content providers in this assembly
var compositionContainer = new CompositionContainer(new AssemblyCatalog(typeof(ResourceProcessor).Assembly));
compositionContainer.ComposeExportedValue(kernel);
return compositionContainer.GetExportedValues<IContentProvider>().ToList();
}
示例2: RegisterIMappingEngine
private void RegisterIMappingEngine(IKernel kernel)
{
kernel.Register(
Component.For<IMappingEngine>()
.UsingFactoryMethod(k => new MappingEngine(kernel.Resolve<IConfigurationProvider>()))
);
}
示例3: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
// Load BusinessLogic plugin
kernel.Bind<ISiteManager>().To<SiteManager>();
kernel.Bind<ISupplierManager>().To<SupplierManager>();
kernel.Bind<IProductManager>().To<ProductManager>();
}
示例4: ProcessModel
public void ProcessModel(IKernel kernel, ComponentModel model)
{
if (model.Configuration == null)
{
return;
}
var remoteserverAttValue = model.Configuration.Attributes["remoteserver"];
var remoteclientAttValue = model.Configuration.Attributes["remoteclient"];
var server = RemotingStrategy.None;
var client = RemotingStrategy.None;
if (remoteserverAttValue == null && remoteclientAttValue == null)
{
return;
}
if (remoteserverAttValue != null)
{
server = converter.PerformConversion<RemotingStrategy>(remoteserverAttValue);
}
if (remoteclientAttValue != null)
{
client = converter.PerformConversion<RemotingStrategy>(remoteclientAttValue);
}
DoSemanticCheck(server, model, client);
ConfigureServerComponent(server, model.Implementation, model);
ConfigureClientComponent(client, model.Services.Single(), model);
}
示例5: Register
public override void Register(IKernel kernel)
{
AddFacility<FactorySupportFacility>(kernel);
RegisterIConfigurationProviderAndIProfileExpression(kernel);
RegisterIMappingEngine(kernel);
}
示例6: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
var types = AutoMapperConfig.GetTypesInAssembly();
var config = AutoMapperConfig.ConfigureAutomapper(types);
var mapper = config.CreateMapper();
kernel.Bind<MapperConfiguration>().ToMethod(c => config).InSingletonScope();
kernel.Bind<IMapper>().ToConstant(mapper);
kernel.Bind(typeof(IRepository<>)).To(typeof(EfGenericRepository<>));
kernel.Bind<IDiagnoseMeDbContext>().To<DiagnoseMeDbContext>().InRequestScope();
kernel.Bind(
b =>
b.From(Assemblies.DataServices)
.SelectAllClasses()
.BindDefaultInterface());
kernel.Bind(
b =>
b.From(Assemblies.WebServices)
.SelectAllClasses()
.BindDefaultInterface());
}
示例7: Init
public void Init(IKernel kernel, Castle.Core.Configuration.IConfiguration facilityConfig)
{
Assert.IsNotNull(kernel);
Assert.IsNotNull(facilityConfig);
Initialized = true;
}
示例8: ProductVariantModelBinder
public ProductVariantModelBinder(ISetVariantTypeProperties setVariantTypeProperties, ISetRestrictedShippingMethods setRestrictedShippingMethods, ISetETagService setETagService, IKernel kernel)
: base(kernel)
{
_setVariantTypeProperties = setVariantTypeProperties;
_setRestrictedShippingMethods = setRestrictedShippingMethods;
_setETagService = setETagService;
}
示例9: ProcessModel
public void ProcessModel(IKernel kernel, ComponentModel model)
{
if (model.Configuration == null)
{
return;
}
var mixins = model.Configuration.Children["mixins"];
if (mixins == null)
{
return;
}
var mixinReferences = new List<ComponentReference<object>>();
foreach (var mixin in mixins.Children)
{
var value = mixin.Value;
var mixinComponent = ReferenceExpressionUtil.ExtractComponentKey(value);
if (mixinComponent == null)
{
throw new Exception(
String.Format("The value for the mixin must be a reference to a component (Currently {0})", value));
}
mixinReferences.Add(new ComponentReference<object>("mixin-" + mixinComponent, mixinComponent));
}
if (mixinReferences.Count == 0)
{
return;
}
var options = ProxyUtil.ObtainProxyOptions(model, true);
mixinReferences.ForEach(options.AddMixinReference);
}
示例10: RegisterServices
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<IUnitOfWork>().To<DatabaseContext>();
kernel.Bind<ITrackRepository>().To<TrackRepository>().InRequestScope();
kernel.Bind<IAlbumRepository>().To<AlbumRepository>().InRequestScope();
//kernel.Bind<IFilmRepository>().To<FilmRepository>();
}
示例11: ProcessModel
/// <summary>
/// Queries the kernel's ConfigurationStore for a configuration
/// associated with the component name.
/// </summary>
/// <param name="kernel"></param>
/// <param name="model"></param>
public virtual void ProcessModel(IKernel kernel, ComponentModel model)
{
IConfiguration config = kernel.ConfigurationStore.GetComponentConfiguration(model.Name) ??
kernel.ConfigurationStore.GetBootstrapComponentConfiguration(model.Name);
model.Configuration = config;
}
示例12: ParticlesTest
public ParticlesTest(IKernel kernel, ContentManager content, GraphicsDevice device)
: base("Particles", kernel)
{
_kernel = kernel;
_content = content;
_device = device;
}
示例13: Create
public object Create(IProxyFactoryExtension customFactory, IKernel kernel, ComponentModel model,
CreationContext context, params object[] constructorArguments)
{
throw new NotImplementedException(
"You must supply an implementation of IProxyFactory " +
"to use interceptors on the Microkernel");
}
示例14: AbstractComponentActivator
/// <summary>
/// Constructs an AbstractComponentActivator
/// </summary>
protected AbstractComponentActivator(ComponentModel model, IKernel kernel, ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction)
{
this.model = model;
this.kernel = kernel;
this.onCreation = onCreation;
this.onDestruction = onDestruction;
}
示例15: ActiveFeatureFactory
public ActiveFeatureFactory(IKernel kernel, IInstanceConfiguration instanceConfiguration, ILog log, ILoggingConfiguration loggingConfiguration)
{
_kernel = kernel;
_instanceConfiguration = instanceConfiguration;
_log = log;
_loggingConfiguration = loggingConfiguration;
}