Exemplo n.º 1
0
        public TPublic Bind(string name, object instance)
        {
            var oObject = (IPublicObject)Activator.CreateInstance(typeof(TPublic), name, instance);

            foreach (var prop in oObject.GetType()
                     .GetRuntimeProperties()
                     .Where(p => typeof(IInjectable).GetTypeInfo().IsAssignableFrom(p.PropertyType.GetTypeInfo())))

            {
                var service = _containerService.GetInstance(prop.PropertyType);
                prop.SetValue(oObject, service);
            }

            return(oObject as TPublic);
        }
Exemplo n.º 2
0
        public IPublicObject Get(string handle)
        {
            if (handle == "")
            {
                // #RegistrationService get the handle associated with the button
                handle = _registrationService.GetAssociatedHandle();
            }

            var oObject = ExcelInterfaces.Public.This(handle);

            foreach (var prop in oObject.GetType()
                     .GetRuntimeProperties()
                     .Where(p => typeof(IInjectable).GetTypeInfo().IsAssignableFrom(p.PropertyType.GetTypeInfo())))

            {
                var service = _containerService.GetInstance(prop.PropertyType);
                prop.SetValue(oObject, service);
            }

            return(oObject);
        }
Exemplo n.º 3
0
 public ObjectRepository(IContainerService containerService)
 {
     _containerService    = containerService;
     _registrationService = containerService.GetInstance <IRegistrationService>();
 }