private void _LoadSoul(int type_id, long id, bool return_type) { MemberMap map = _Protocol.GetMemberMap(); Type type = map.GetInterface(type_id); IProvider provider = _QueryProvider(type); IGhost ghost = _BuildGhost(type, id, return_type); ghost.CallMethodEvent += new GhostMethodHandler(ghost, _ReturnValueQueue, _Protocol, _Requester).Run; ghost.AddEventEvent += new GhostEventMoveHandler(ghost, _Protocol, _Requester).Add; ghost.RemoveEventEvent += new GhostEventMoveHandler(ghost, _Protocol, _Requester).Remove; provider.Add(ghost); if (ghost.IsReturnType()) { _RegisterRelease(ghost); } }
private IGhost _Add(T entity, IGhost ghost) { if (ghost.IsReturnType() == false) { lock (_Entitys) _Entitys.Add(entity); if (_Supply != null) { _Supply.Invoke(entity); } } else { _Returns.Add(new WeakReference(entity)); if (_Return != null) { _Return(entity); } } return(ghost); }