Beispiel #1
0
 public static IAdviceOrderSyntax WithDefaultCache <T>(this IBindingNamedWithOrOnSyntax <T> bindingSyntax)
 {
     return(bindingSyntax.Intercept().With <NinjectCachingInterceptor>());
 }
Beispiel #2
0
 /// <summary>
 /// Indicates that instances associated with this binding will be proxied.
 /// </summary>
 /// <typeparam name="T">The type associated with this binding.</typeparam>
 /// <param name="bindingSyntax">The binding syntax target.</param>
 /// <param name="additionalInterfaces">The additional interfaces for the proxy.</param>
 /// <returns>
 ///     An <see cref="IAdviceTargetSyntax"/> instance which allows the attachment of an <see cref="IInterceptor"/>.
 /// </returns>
 public static IAdviceTargetSyntax Intercept <T>(this IBindingNamedWithOrOnSyntax <T> bindingSyntax, params Type[] additionalInterfaces)
 {
     return(DoIntercept(bindingSyntax, additionalInterfaces));
 }
 /// <summary>
 /// Indicates that instances associated with this binding will be proxied.
 /// </summary>
 /// <typeparam name="T">The type associated with this binding.</typeparam>
 /// <param name="bindingSyntax">The binding syntax target.</param>
 /// <returns>
 ///     An <see cref="IAdviceTargetSyntax"/> instance which allows the attachment of an <see cref="IInterceptor"/>.
 /// </returns>
 public static IAdviceTargetSyntax Intercept <T>(this IBindingNamedWithOrOnSyntax <T> bindingSyntax)
 {
     return(DoIntercept(bindingSyntax));
 }
        private static void SetNamed(IBindingNamedWithOrOnSyntax<object> syntax, Type type)
        {
            var named = type
                .GetCustomAttributes(typeof(NamedAttribute), true)
                .OfType<NamedAttribute>()
                .Select(x => x.Name)
                .FirstOrDefault();

            if (named != null)
                syntax.Named(named);
        }