Esempio n. 1
0
        public void Load(DataBusPropertyInfo propertyInfo, object message)
        {
            if (propertyInfo == null)
            {
                throw new ArgumentNullException("propertyInfo");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            _log.Info(
                "Loading databus property '{0}' on message of type '{1}'.",
                propertyInfo.Name,
                message.GetType().FullName);

            IDataBusProperty propertyInstance = propertyInfo.GetPropertyInstance(message) as IDataBusProperty;

            if (propertyInstance == null || !propertyInstance.HasValue)
            {
                _log.Warn(
                    String.Format(
                        "Databus property '{0}' on message of type '{1}' is null or doesn't have a value.",
                        propertyInfo.Name,
                        message.GetType().FullName));

                return;
            }

            LoadValueFromDataBus(propertyInstance, propertyInfo);
        }
Esempio n. 2
0
        public void Offload(DataBusPropertyInfo propertyInfo, object message)
        {
            if (propertyInfo == null)
            {
                throw new ArgumentNullException("propertyInfo");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            _log.Info(
                "Offloading databus property '{0}' on message of type {1}.",
                propertyInfo.Name,
                message.GetType().FullName);

            IDataBusProperty propertyInstance = propertyInfo.GetPropertyInstance(message) as IDataBusProperty;

            if (propertyInstance == null)
            {
                _log.Warn(
                    String.Format(
                        "Databus property '{0}' on message of type '{1}'. is null.",
                        propertyInfo.Name,
                        message.GetType().FullName));

                return;
            }

            object valueToPutOnBus = propertyInstance.GetValue();

            if (valueToPutOnBus != null)
            {
                PutValueOnDataBus(propertyInstance, valueToPutOnBus, propertyInfo);
            }
            else
            {
                _log.Warn("Value of databus property '{0} ' is null.", propertyInfo.Name);
            }
        }