示例#1
0
        public object Get(Transaction trans, object onObject)
        {
            if (_containingClass == null)
            {
                return(null);
            }
            ObjectContainerBase container = Container();

            if (container == null)
            {
                return(null);
            }
            lock (container.Lock())
            {
                // FIXME: The following is not really transactional.
                //        This will work OK for normal C/S and for
                //        single local mode but the transaction will
                //        be wrong for MTOC.
                if (trans == null)
                {
                    trans = container.Transaction;
                }
                container.CheckClosed();
                ObjectReference @ref = trans.ReferenceForObject(onObject);
                if (@ref == null)
                {
                    return(null);
                }
                int id = @ref.GetID();
                if (id <= 0)
                {
                    return(null);
                }
                UnmarshallingContext context = new UnmarshallingContext(trans, @ref, Const4.AddToIdTree
                                                                        , false);
                context.ActivationDepth(new LegacyActivationDepth(1));
                return(context.ReadFieldValue(this));
            }
        }