Пример #1
0
        public AttributeImpl(
            [NotNull] IAttributeDescriptor descriptor,
            [NotNull] Attribute attribute,
            [NotNull] IReflection reflection)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }
            if (reflection == null)
            {
                throw new ArgumentNullException(nameof(reflection));
            }
            var type = attribute.GetType();

            Descriptor = descriptor;
            var typeInfo = reflection.CreateType(type);

            _properties = (
                from property in typeInfo.Properties
                select new { name = property.Name, value = property.GetValue(attribute) }).ToDictionary(i => i.name, i => i.value);
        }
Пример #2
0
 public Binding(Type k)
 {
     m_TypeK         = k;
     reflection      = new Reflection();
     _dicName2Obj    = new Dictionary <string, object>();
     _dicName2Single = new Dictionary <string, bool>();
 }
 public NHibernateSagaPersister(INHibernateSessionProvider session, IServiceLocator serviceLocator, IMessageSerializer messageSerializer, IReflection reflection)
 {
     this.session           = session.CurrentSession;
     this.serviceLocator    = serviceLocator;
     this.messageSerializer = messageSerializer;
     this.reflection        = reflection;
 }
Пример #4
0
 public XmlMessageSerializer(IReflection reflection, IKernel kernel )
 {
     this.reflection = reflection;
     this.kernel = kernel;
     customElementSerializers = this.kernel.ResolveAll<ICustomElementSerializer>();
     elementSerializationBehaviors = this.kernel.ResolveAll<IElementSerializationBehavior>();
 }
Пример #5
0
 public DataDictionarySeederController(IReflection reflectionHelper, string assemblyName)
 {
     assemblyName.Guard("AssemblyName must not be empty or null.");
     reflectionHelper.Guard("ReflectionHelper must not be null.");
     _reflectionHelper = reflectionHelper;
     _assemblyName     = assemblyName;
 }
 	public XmlMessageSerializer(IReflection reflection, IServiceLocator serviceLocator )
     {
         this.reflection = reflection;
         this.serviceLocator = serviceLocator;
     	customElementSerializers = this.serviceLocator.ResolveAll<ICustomElementSerializer>().ToArray();
 		elementSerializationBehaviors = this.serviceLocator.ResolveAll<IElementSerializationBehavior>().ToArray();
     }
Пример #7
0
 public XmlMessageSerializer(IReflection reflection, IServiceLocator serviceLocator)
 {
     this.reflection               = reflection;
     this.serviceLocator           = serviceLocator;
     customElementSerializers      = this.serviceLocator.ResolveAll <ICustomElementSerializer>().ToArray();
     elementSerializationBehaviors = this.serviceLocator.ResolveAll <IElementSerializationBehavior>().ToArray();
 }
Пример #8
0
 public XmlMessageSerializer(IReflection reflection, IKernel kernel)
 {
     this.reflection               = reflection;
     this.kernel                   = kernel;
     customElementSerializers      = this.kernel.ResolveAll <ICustomElementSerializer>();
     elementSerializationBehaviors = this.kernel.ResolveAll <IElementSerializationBehavior>();
 }
Пример #9
0
 private static void RegisterSingles<T>(IReflection reflection, ContainerBuilder builder)
 {
     var objTypes = reflection.AssignableTypes<T>();
     foreach (var objType in objTypes)
     {
         builder.RegisterType(objType).AsSelf().InstancePerDependency();
     }
 }
Пример #10
0
 private static void RegisterSinglesAs(IReflection reflection, ContainerBuilder builder)
 {
     var injectablesAsEnumerable = reflection.AssignableTypes<Common.Modules.IInjectableAsEnumerable>();
     foreach (var injectable in injectablesAsEnumerable)
     {
         builder.RegisterType(injectable).As(reflection.GetBaseType(injectable)).SingleInstance();
     }
 }
Пример #11
0
        public SingletonManager(IReflection reflection, ILogger logger, IFactory factory)
        {
            Argument.NotNull(() => logger);
            Argument.NotNull(() => factory);

            this.logger     = logger;
            this.factory    = factory;
            this.Singletons = new object[0];
        }
Пример #12
0
        public SingletonScanner(IReflection reflection, ILogger logger, ISingletonManager singletonManager)
        {
            Argument.NotNull(() => reflection);
            Argument.NotNull(() => logger);
            Argument.NotNull(() => singletonManager);

            this.reflection = reflection;
            this.logger = logger;
            this.singletonManager = singletonManager;
        }
Пример #13
0
        public LookupFactory(IReflection helper, IUnitOfWork unitOfWork, string assemblyName)
        {
            assemblyName.Guard("AssemblyName must not be null");
            unitOfWork.Guard("UnitOfWork must not be null.");
            helper.Guard("ReflectionHelper must not be null.");

            _helper       = helper;
            _unitOfWork   = unitOfWork;
            _assemblyName = assemblyName;
        }
Пример #14
0
 public FileSubscriptionStorage(
     string subscriptionPath,
     IMessageSerializer messageSerializer,
     IReflection reflection)
 {
     _subscriptionPath = subscriptionPath;
     _messageSerializer = messageSerializer;
     _reflection = reflection;
     _pht = new HashTable(subscriptionPath);
 }
 public PhtSubscriptionStorage(
     string subscriptionPath,
     IMessageSerializer messageSerializer,
     IReflection reflection)
 {
     this.subscriptionPath = subscriptionPath;
     this.messageSerializer = messageSerializer;
     this.reflection = reflection;
     pht = new PersistentHashTable.PersistentHashTable(subscriptionPath);
 }
Пример #16
0
 public PhtSubscriptionStorage(
     string subscriptionPath,
     IMessageSerializer messageSerializer,
     IReflection reflection)
 {
     this.subscriptionPath  = subscriptionPath;
     this.messageSerializer = messageSerializer;
     this.reflection        = reflection;
     pht = new PersistentHashTable.PersistentHashTable(subscriptionPath);
 }
Пример #17
0
        public SingletonScanner(IReflection reflection, ILogger logger, ISingletonManager singletonManager)
        {
            Argument.NotNull(() => reflection);
            Argument.NotNull(() => logger);
            Argument.NotNull(() => singletonManager);

            this.reflection       = reflection;
            this.logger           = logger;
            this.singletonManager = singletonManager;
        }
 public GenericSubscriptionStorage(
     IStorage storage,
     string localEndpoint,
     IMessageSerializer messageSerializer,
     IReflection reflection)
 {
     this.storage           = storage;
     this.localEndpoint     = localEndpoint;
     this.messageSerializer = messageSerializer;
     this.reflection        = reflection;
 }
Пример #19
0
        static DI()
        {
            log = PublicDI.log; // _note that when the O2GuiWithDockPanel is create it will overide the PublicDI log with WinFormsUILog() object
            reflection = PublicDI.reflection;
            config = PublicDI.config;
            o2MessageQueue = KO2MessageQueue.getO2KernelQueue();

            new O2MessagesHandler(); // set up O2Message hook

            autoAddLogViewerToGui = true;
        }
Пример #20
0
        public Factory(string name, ILogger logger)
        {
            Argument.StringNotNullOrEmpty(() => name);
            Argument.NotNull(() => logger);

            this.Name       = name;
            this.logger     = logger;
            this.reflection = new Reflection();

            this.Dep <IFactory>(this);
        }
 public MsmqSubscriptionStorage(
     IReflection reflection,
     IMessageSerializer messageSerializer,
     Uri subscriptionQueue,
     IQueueStrategy queueStrategy
     )
 {
     this.reflection = reflection;
     this.messageSerializer = messageSerializer;
     this.queueStrategy = queueStrategy;
     this.subscriptionQueue = this.queueStrategy.CreateSubscriptionQueueUri(subscriptionQueue);
 }
Пример #22
0
        public LinkedCascadeData(IReflection helper, IUnitOfWork unitOfWork, string entityModelType, string domainAssemblyName)
        {
            helper.Guard("ReflectionHelper must not be null.");
            unitOfWork.Guard("UnitOfWork must nit be null.");
            entityModelType.Guard("TypeName must not be null or empty.");
            domainAssemblyName.Guard("DomainAssemblyName must not be null or empty.");

            _helper             = helper;
            _unitOfWork         = unitOfWork;
            _entityModelType    = entityModelType;
            _domainAssemblyName = domainAssemblyName;
        }
Пример #23
0
 public PropertyInfoImpl(
     [NotNull] IReflection reflection,
     [NotNull] PropertyInfo property)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (property == null)
     {
         throw new ArgumentNullException(nameof(property));
     }
     _property = property;
 }
 public MsmqSubscriptionStorage(
     IReflection reflection,
     IMessageSerializer messageSerializer,
     Uri queueBusListensTo,
     IEndpointRouter  endpointRouter,
     IQueueStrategy queueStrategy
     )
 {
     this.reflection = reflection;
     this.messageSerializer = messageSerializer;
     this.endpointRouter = endpointRouter;
     this.queueStrategy = queueStrategy;
     this.subscriptionQueue = this.queueStrategy.CreateSubscriptionQueueUri(queueBusListensTo);
 }
Пример #25
0
        public Factory(string name, IFactory fallbackFactory, ILogger logger, IReflection reflection)
        {
            Argument.StringNotNullOrEmpty(() => name);
            Argument.NotNull(() => fallbackFactory);
            Argument.NotNull(() => logger);
            Argument.NotNull(() => reflection);

            this.Name            = name;
            this.fallbackFactory = fallbackFactory;
            this.logger          = logger;
            this.reflection      = reflection;

            this.Dep <IFactory>(this);
        }
Пример #26
0
 public MsmqSubscriptionStorage(
     IReflection reflection,
     IMessageSerializer messageSerializer,
     Uri queueBusListensTo,
     IEndpointRouter endpointRouter,
     IQueueStrategy queueStrategy
     )
 {
     this.reflection        = reflection;
     this.messageSerializer = messageSerializer;
     this.endpointRouter    = endpointRouter;
     this.queueStrategy     = queueStrategy;
     this.subscriptionQueue = this.queueStrategy.CreateSubscriptionQueueUri(queueBusListensTo);
 }
Пример #27
0
 public AssemblyInfoImpl(
     [NotNull] IReflection reflection,
     [NotNull] Assembly assembly)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (assembly == null)
     {
         throw new ArgumentNullException(nameof(assembly));
     }
     _reflection = reflection;
     _assembly   = assembly;
 }
Пример #28
0
 public ParameterInfoImpl(
     [NotNull] IReflection reflection,
     [NotNull] ParameterInfo parameterInfo)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (parameterInfo == null)
     {
         throw new ArgumentNullException(nameof(parameterInfo));
     }
     _reflection    = reflection;
     _parameterInfo = parameterInfo;
 }
Пример #29
0
 public AttributeAccessor(
     [NotNull] IReflection reflection,
     [NotNull] Func <IAttributeDescriptor, Attribute, IAttribute> attributeFactory)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (attributeFactory == null)
     {
         throw new ArgumentNullException(nameof(attributeFactory));
     }
     _reflection       = reflection;
     _attributeFactory = attributeFactory;
 }
Пример #30
0
 public MethodInfoImpl(
     [NotNull] IReflection reflection,
     [NotNull] MethodInfo methodInfo)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (methodInfo == null)
     {
         throw new ArgumentNullException(nameof(methodInfo));
     }
     _reflection = reflection;
     _methodInfo = methodInfo;
 }
Пример #31
0
        public static ReflectionDto ToDto(this IReflection reflection)
        {
            var dto = new ReflectionDto
            {
                Mirror            = reflection.Mirror.ToDto(),
                Id                = reflection.Id,
                DateTime          = reflection.DateTime,
                TargetRevision    = reflection.TargetRevision.ToDto(),
                SourceRevision    = reflection.SourceRevision.ToDto(),
                Synchronization   = reflection.Synchronization.ToDto(),
                MirrorId          = reflection.Mirror.Id,
                SynchronizationId = reflection.Synchronization.Id
            };

            return(dto);
        }
Пример #32
0
 public DefaultServiceBus(
     IServiceLocator serviceLocator,
     ITransport transport,
     ISubscriptionStorage subscriptionStorage,
     IReflection reflection,
     IMessageModule[] modules,
     MessageOwner[] messageOwners,
     IEndpointRouter endpointRouter)
 {
     this.transport           = transport;
     this.endpointRouter      = endpointRouter;
     this.messageOwners       = new MessageOwnersSelector(messageOwners, endpointRouter);
     this.subscriptionStorage = subscriptionStorage;
     this.reflection          = reflection;
     this.modules             = modules;
     this.serviceLocator      = serviceLocator;
 }
Пример #33
0
 public Discoverer(
     [NotNull] IReflection reflection,
     [NotNull] IAttributeMap attributeMap,
     [NotNull] IAttributeAccessor attributeAccessor,
     [NotNull] IGenericArgsProvider genericArgsProvider,
     [NotNull] IArgsProvider argsProvider,
     [NotNull] Func <ITestInfo, ICase> caseFactory,
     [NotNull] IRunner runner)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (attributeMap == null)
     {
         throw new ArgumentNullException(nameof(attributeMap));
     }
     if (attributeAccessor == null)
     {
         throw new ArgumentNullException(nameof(attributeAccessor));
     }
     if (genericArgsProvider == null)
     {
         throw new ArgumentNullException(nameof(genericArgsProvider));
     }
     if (argsProvider == null)
     {
         throw new ArgumentNullException(nameof(argsProvider));
     }
     if (caseFactory == null)
     {
         throw new ArgumentNullException(nameof(caseFactory));
     }
     if (runner == null)
     {
         throw new ArgumentNullException(nameof(runner));
     }
     _reflection          = reflection;
     _attributeMap        = attributeMap;
     _attributeAccessor   = attributeAccessor;
     _genericArgsProvider = genericArgsProvider;
     _argsProvider        = argsProvider;
     _caseFactory         = caseFactory;
     _runner = runner;
 }
Пример #34
0
        public TypeInfoImpl(
            [NotNull] IReflection reflection,
            [NotNull] Type type)
        {
            if (reflection == null)
            {
                throw new ArgumentNullException(nameof(reflection));
            }
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            _reflection = reflection;
            _type       = type;
#if !NET35 && !NET40
            _typeInfo = type.GetTypeInfo();
#endif
        }
Пример #35
0
 public ArgsProvider(
     [NotNull] IReflection reflection,
     [NotNull] IAttributeMap attributeMap,
     [NotNull] IAttributeAccessor attributeAccessor)
 {
     if (reflection == null)
     {
         throw new ArgumentNullException(nameof(reflection));
     }
     if (attributeMap == null)
     {
         throw new ArgumentNullException(nameof(attributeMap));
     }
     if (attributeAccessor == null)
     {
         throw new ArgumentNullException(nameof(attributeAccessor));
     }
     _reflection        = reflection;
     _attributeMap      = attributeMap;
     _attributeAccessor = attributeAccessor;
 }
Пример #36
0
        /// <summary>
        /// Helper function to search for and auto-register factory types.
        /// Mockable interfaces are passed in for testing.
        /// </summary>
        public static void AutoRegisterTypes(IReflection reflection, IFactory factory)
        {
            Argument.NotNull(() => reflection);
            Argument.NotNull(() => factory);

            // Add factory creatable definitions
            var factoryCreatableTypes = reflection.FindTypesMarkedByAttributes(new Type[] { typeof(FactoryCreatableAttribute) });

            foreach (var factoryCreatableType in factoryCreatableTypes)
            {
                var attributes = reflection.GetAttributes <FactoryCreatableAttribute>(factoryCreatableType);
                foreach (var attribute in attributes)
                {
                    var name = attribute.TypeName;
                    if (string.IsNullOrEmpty(name))
                    {
                        name = factoryCreatableType.Name;
                    }

                    factory.Type(name, factoryCreatableType);
                }
            }
        }
Пример #37
0
        private void mainForm_Load(object sender, EventArgs e)
        {
            var files = Directory.GetFiles("Modules", "*.dll", SearchOption.TopDirectoryOnly);

            foreach (var file in files)
            {
                Assembly myAssembly = Assembly.LoadFrom(file);
                Type     type       =
                    myAssembly.GetTypes().Where(t => t.IsClass && t.GetInterface(typeof(IReflection).ToString()) == typeof(IReflection)).First();

                if (type == null)
                {
                    continue;
                }

                IReflection r = (IReflection)Activator.CreateInstance(type);

                UserControl uc = r.GetControl();
                uc.Dock = DockStyle.Fill;

                mainMenuStrip.Items.Add(r.Caption, null, (o, args) =>
                {
                    foreach (Control control in Controls)
                    {
                        if (control != uc && control != mainMenuStrip)
                        {
                            Controls.Remove(control);
                        }
                    }
                    if (!Controls.Contains(uc))
                    {
                        Controls.Add(uc);
                    }
                });
            }
        }
Пример #38
0
 public ScopeClosure(Environment scope, IReflection reflection)
 {
     _reflection = reflection;
     _scope      = scope;
 }
Пример #39
0
        public SingletonManager(IReflection reflection, ILogger logger, IFactory factory)
        {
            Argument.NotNull(() => reflection);
            Argument.NotNull(() => logger);
            Argument.NotNull(() => factory);

            this.reflection = reflection;
            this.logger = logger;
            this.factory = factory;
            this.Singletons = new object[0];
        }
Пример #40
0
 static DI()
 {
     config = PublicDI.config;
     log = PublicDI.log;
     reflection = PublicDI.reflection;
 }
Пример #41
0
 static DI()
 {
     config = PublicDI.config;   // need to use local copy
     log = PublicDI.log;
     reflection = PublicDI.reflection;
 }
Пример #42
0
 public JsonSerializer(IReflection reflection)
 {
     this.reflection = reflection;
 }
Пример #43
0
 public XmlMessageSerializer(IReflection reflection, IKernel kernel )
 {
     this.reflection = reflection;
     this.kernel = kernel;
 }