示例#1
0
		private static TransportObjectContainer NewTransportObjectContainer(ObjectContainerBase
			 serviceProvider, MemoryBin memoryBin)
		{
			TransportObjectContainer container = new TransportObjectContainer(serviceProvider
				, memoryBin);
			container.DeferredOpen();
			return container;
		}
示例#2
0
        private static TransportObjectContainer NewTransportObjectContainer(ObjectContainerBase
                                                                            serviceProvider, MemoryBin memoryBin)
        {
            TransportObjectContainer container = new TransportObjectContainer(serviceProvider
                                                                              , memoryBin);

            container.DeferredOpen();
            return(container);
        }
示例#3
0
        public static SerializedGraph Marshall(ObjectContainerBase serviceProvider, object
                                               obj)
        {
            MemoryBin memoryBin = new MemoryBin(223, GrowthStrategy());
            TransportObjectContainer carrier = NewTransportObjectContainer(serviceProvider, memoryBin
                                                                           );

            carrier.ProduceClassMetadata(carrier.Reflector().ForObject(obj));
            carrier.Store(obj);
            int id = (int)carrier.GetID(obj);

            carrier.Close();
            return(new SerializedGraph(id, memoryBin.Data()));
        }
示例#4
0
        public static object Unmarshall(ObjectContainerBase serviceProvider, byte[] bytes
                                        , int id)
        {
            if (id <= 0)
            {
                return(null);
            }
            MemoryBin memoryBin = new MemoryBin(bytes, GrowthStrategy());
            TransportObjectContainer carrier = NewTransportObjectContainer(serviceProvider, memoryBin
                                                                           );
            object obj = carrier.GetByID(id);

            carrier.Activate(carrier.Transaction, obj, new FullActivationDepth());
            carrier.Close();
            return(obj);
        }