Exemplo n.º 1
0
        /// <summary>
        /// Casts to <see cref="BinaryObject"/> or throws an error.
        /// </summary>
        private static BinaryObject GetBinaryObject(IBinaryObject obj)
        {
            var binObj = obj as BinaryObject;

            if (binObj != null)
                return binObj;

            throw new NotSupportedException(string.Format("{0} of type {1} is not supported.",
                typeof(IBinaryObject), obj.GetType()));
        }
Exemplo n.º 2
0
        /** <inheritDoc /> */
        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
        {
            IgniteArgumentCheck.NotNull(obj, "obj");

            BinaryObject obj0 = obj as BinaryObject;

            if (obj0 == null)
                throw new ArgumentException("Unsupported object type: " + obj.GetType());

            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
            
            return Builder0(null, obj0, desc);
        }
Exemplo n.º 3
0
        /** <inheritDoc /> */
        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
        {
            IgniteArgumentCheck.NotNull(obj, "obj");

            BinaryObject obj0 = obj as BinaryObject;

            if (obj0 == null)
            {
                throw new ArgumentException("Unsupported object type: " + obj.GetType());
            }

            if (obj0 is BinaryEnum)
            {
                throw new InvalidOperationException("Builder cannot be created for enum.");
            }

            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);

            return(Builder0(null, obj0, desc));
        }