private static void ConfigureClass(Type type, IRegistry registry, FireOptions fireOption, DependencyMap dependencyMap)
        {
            var inst = new LooseConstructorInstance(context =>
            {
                var ctorArgs = type
                    .GetGreediestCtor()
                    .GetParameters()
                    .Select(p => context.GetInstance(p.ParameterType));

                return Notifiable.MakeForClass(type, fireOption, ctorArgs.ToArray(), new ProxyGenerator(), dependencyMap);
            });

            registry.For(type).Use(inst);
        }
コード例 #2
0
 public static IInterception Create(PropertyChangedInterceptor propertyChangedInterceptor, IInvocation invocation, FireOptions fireOption, ILog log)
 {
     if(invocation.IsPropertyChangedAdd())
         return new PropertyChangedAddInterception(propertyChangedInterceptor, invocation);
     if(invocation.IsPropertyChangedRemove())
         return new PropertyChangedRemoveInterception(propertyChangedInterceptor, invocation);
     if(invocation.IsPropertySetter() && FireOptions.OnlyOnChange == fireOption)
         return new OnlyOnChangePropertySetterInterception(propertyChangedInterceptor, invocation, log).WrapWith(
             new PropertyIsINotifyInterception(propertyChangedInterceptor, invocation));
     if(invocation.IsPropertySetter())
         return new PropertySetterInterception(propertyChangedInterceptor, invocation).WrapWith(
             new PropertyIsINotifyInterception(propertyChangedInterceptor, invocation));
     return new InvocationInterception(invocation);
 }
 private static void ConfigureInterface(Type type, IRegistry registry, FireOptions fireOption, DependencyMap dependencyMap)
 {
     registry
         .For(type)
         .EnrichWith((context, obj) => Notifiable.MakeForInterface(type, obj, fireOption, new ProxyGenerator(), dependencyMap));
 }
コード例 #4
0
 public PropertyChangedInterceptor(FireOptions fireOption, DependencyMap dependencyMap)
 {
     _fireOption = fireOption;
     _dependencyMap = dependencyMap;
 }