/// <summary> /// Configures the Apworks framework by using Unity as the object container. /// </summary> /// <param name="configurator">The <see cref="IInterceptionConfigurator"/> instance to be extended.</param> /// <param name="initFromConfigFile">The <see cref="System.Boolean"/> value which indicates whether the container configuration should be read from the config file.</param> /// <param name="sectionName">The name of the section in the config file. This value must be specified when the <paramref name="initFromConfigFile"/> parameter is set to true.</param> /// <returns>The <see cref="IObjectContainerConfigurator"/> instace.</returns> public static IObjectContainerConfigurator UsingUnityContainer(this IInterceptionConfigurator configurator, bool initFromConfigFile = false, string sectionName = null) { return(configurator.UsingObjectContainer <UnityObjectContainer>(initFromConfigFile, sectionName)); }
/// <summary> /// Registers an interceptor on the given method of a given type. /// </summary> /// <typeparam name="TInterceptor">The type of the interceptor to be registered.</typeparam> /// <typeparam name="TContract">The type which contains the method to be intercepted.</typeparam> /// <param name="configurator">The <see cref="IInterceptionConfigurator"/> instance to be extended.</param> /// <param name="interceptMethod">The method to be intercepted.</param> /// <returns>The <see cref="IInterceptionConfigurator"/> instance.</returns> public static IInterceptionConfigurator RegisterInterception <TInterceptor, TContract>(this IInterceptionConfigurator configurator, string interceptMethod) where TInterceptor : IInterceptor { return(new InterceptionConfigurator(configurator, typeof(TInterceptor), typeof(TContract), interceptMethod)); }
/// <summary> /// Configures the Apworks framework by using the specified object container. /// </summary> /// <typeparam name="TObjectContainer">The type of the object container to be used by the framework.</typeparam> /// <param name="configurator">The <see cref="IInterceptionConfigurator"/> instance to be extended.</param> /// <param name="initFromConfigFile">The <see cref="Boolean"/> value which indicates whether the container configuration should be read from the config file.</param> /// <param name="sectionName">The name of the section in the config file. This value must be specified when the <paramref name="initFromConfigFile"/> parameter is set to true.</param> /// <returns>The <see cref="IObjectContainerConfigurator"/> instance.</returns> public static IObjectContainerConfigurator UsingObjectContainer <TObjectContainer>(this IInterceptionConfigurator configurator, bool initFromConfigFile = false, string sectionName = null) where TObjectContainer : IObjectContainer { return(new ObjectContainerConfigurator(configurator, typeof(TObjectContainer), initFromConfigFile, sectionName)); }
/// <summary> /// 通过使用Autofac作为对象容器来配置OFoods框架. /// </summary> public static IObjectContainerConfigurator UseAutofacContainer(this IInterceptionConfigurator configurator, bool initFromConfigFile = false, string configPath = null) { return(configurator.UsingObjectContainer <AutofacObjectContainer>(initFromConfigFile, configPath)); }