示例#1
0
 public static ViewInfo FromBinary(ISqlBinary binary)
 {
     using (var stream = binary.GetInput()) {
         var serializer = new BinarySerializer();
         return((ViewInfo)serializer.Deserialize(stream));
     }
 }
示例#2
0
        public static SqlXmlNode XmlType(ISqlBinary binary)
        {
            var len     = binary.Length;
            var content = new byte[len];
            var offset  = 0;

            const int bufferSize = 1024 * 10;

            using (var stream = binary.GetInput()) {
                using (var reader = new BinaryReader(stream)) {
                    while (true)
                    {
                        var buffer    = new byte[bufferSize];
                        var readCount = reader.Read(buffer, 0, bufferSize);

                        Array.Copy(buffer, 0, content, offset, readCount);

                        if (readCount == 0)
                        {
                            break;
                        }

                        offset += readCount;
                    }
                }
            }

            return(new SqlXmlNode(content));
        }
示例#3
0
        public static SqlXmlNode XmlType(ISqlBinary binary)
        {
            var len = binary.Length;
            var content = new byte[len];
            var offset = 0;

            const int bufferSize = 1024 * 10;

            using (var stream = binary.GetInput()) {
                using (var reader = new BinaryReader(stream)) {
                    while (true) {
                        var buffer = new byte[bufferSize];
                        var readCount = reader.Read(buffer, 0, bufferSize);

                        Array.Copy(buffer, 0, content, offset, readCount);

                        if (readCount == 0)
                            break;

                        offset += readCount;
                    }
                }
            }

            return new SqlXmlNode(content);
        }
示例#4
0
 public static ViewInfo FromBinary(ISqlBinary binary)
 {
     using (var stream = binary.GetInput()) {
         var serializer = new BinarySerializer();
         return (ViewInfo) serializer.Deserialize(stream);
     }
 }