protected void ControlRemoteObject(object instance, object value, PropertyInfo propertyInfo)
        {
            // Not letting mono behaviours to be injected if they are not IDIClosedContext
            // (because we cannot control their lifetime)

            IDIClosedContext ctxval = value as IDIClosedContext;

            if (RemoteObjectsHelper.IsRemoteObject(value) && (ctxval == null || !ctxval.IsValid()))
            {
                throw new MiniocException("Injecting a remote object that doesn't implement IDIClosedContext is not allowed ! Tried to inject object " + value + " into property " + propertyInfo.Name + " of the object " + instance);
            }
        }
Beispiel #2
0
        private void RegisterRemoteObject(object instance, bool hashOnly = false)
        {
            if (!RemoteObjectsHelper.IsRemoteObject(instance))
            {
                return;
            }
            IRemoteObjectsRecord remoteRecord = (IRemoteObjectsRecord)this.ResolveInternal(typeof(IRemoteObjectsRecord), null, null, false);

            if (!hashOnly)
            {
                remoteRecord.Register(instance);
            }
            else
            {
                IRemoteObjectsHash hash = (IRemoteObjectsHash)this.ResolveInternal(typeof(IRemoteObjectsHash), null, null, false);
                hash.Register(instance);
            }
        }