Example #1
0
        public void AddNotifierSupply(long entity_id, int property_id, long notifier_id)
        {
            Soul soul = (from s in _Souls.UpdateSet() where s.Id == entity_id select s).FirstOrDefault();

            if (soul == null)
            {
                return;
            }

            PropertyInfo propertyInfo = _Protocol.GetMemberMap().GetProperty(property_id);

            if (propertyInfo == null)
            {
                return;
            }

            Type gpiType = propertyInfo.PropertyType.GetGenericArguments().Single();
            NotifierEventBinder binder = NotifierEventBinder.Create(soul.ObjectInstance, propertyInfo, nameof(INotifier <object> .Supply), (gpi) => _BindSupply(gpi, gpiType, notifier_id));

            if (binder == null)
            {
                return;
            }
            soul.AttachSupply(notifier_id, binder);
        }