static Dictionary <XName, object> ReadLockOwnerMetadata(SqlDataReader reader)
        {
            Dictionary <XName, object> lockOwnerProperties = new Dictionary <XName, object>();
            InstanceEncodingOption     encodingOption      = (InstanceEncodingOption)(reader.GetByte(3));

            byte[]            serializedPrimitiveLockOwnerData = reader.IsDBNull(4) ? null : (byte[])reader.GetValue(4);
            byte[]            serializedComplexLockOwnerData   = reader.IsDBNull(5) ? null : (byte[])reader.GetValue(5);
            IObjectSerializer serializer = ObjectSerializerFactory.GetObjectSerializer(encodingOption);

            Dictionary <XName, object>[] lockOwnerPropertyBags = new Dictionary <XName, object> [2];

            if (serializedPrimitiveLockOwnerData != null)
            {
                lockOwnerPropertyBags[0] = (Dictionary <XName, object>)serializer.DeserializeValue(serializedPrimitiveLockOwnerData);
            }

            if (serializedComplexLockOwnerData != null)
            {
                lockOwnerPropertyBags[1] = serializer.DeserializePropertyBag(serializedComplexLockOwnerData);
            }

            foreach (Dictionary <XName, object> propertyBag in lockOwnerPropertyBags)
            {
                if (propertyBag != null)
                {
                    foreach (KeyValuePair <XName, object> property in propertyBag)
                    {
                        lockOwnerProperties.Add(property.Key, property.Value);
                    }
                }
            }

            return(lockOwnerProperties);
        }
        public static Dictionary <XName, InstanceValue> DeserializePropertyBag(byte[] primitiveDataProperties, byte[] complexDataProperties, InstanceEncodingOption encodingOption)
        {
            IObjectSerializer serializer = ObjectSerializerFactory.GetObjectSerializer(encodingOption);
            Dictionary <XName, InstanceValue> properties = new Dictionary <XName, InstanceValue>();

            Dictionary <XName, object>[] propertyBags = new Dictionary <XName, object> [2];

            if (primitiveDataProperties != null)
            {
                propertyBags[0] = (Dictionary <XName, object>)serializer.DeserializeValue(primitiveDataProperties);
            }

            if (complexDataProperties != null)
            {
                propertyBags[1] = serializer.DeserializePropertyBag(complexDataProperties);
            }

            foreach (Dictionary <XName, object> propertyBag in propertyBags)
            {
                if (propertyBag != null)
                {
                    foreach (KeyValuePair <XName, object> property in propertyBag)
                    {
                        properties.Add(property.Key, new InstanceValue(property.Value));
                    }
                }
            }

            return(properties);
        }
        public static Dictionary <XName, InstanceValue> DeserializePropertyBag(byte[] primitiveDataProperties, byte[] complexDataProperties, InstanceEncodingOption encodingOption)
        {
            IObjectSerializer objectSerializer           = ObjectSerializerFactory.GetObjectSerializer(encodingOption);
            Dictionary <XName, InstanceValue> dictionary = new Dictionary <XName, InstanceValue>();

            Dictionary <XName, object>[] dictionaryArray = new Dictionary <XName, object> [2];
            if (primitiveDataProperties != null)
            {
                dictionaryArray[0] = (Dictionary <XName, object>)objectSerializer.DeserializeValue(primitiveDataProperties);
            }
            if (complexDataProperties != null)
            {
                dictionaryArray[1] = objectSerializer.DeserializePropertyBag(complexDataProperties);
            }
            foreach (Dictionary <XName, object> dictionary2 in dictionaryArray)
            {
                if (dictionary2 != null)
                {
                    foreach (KeyValuePair <XName, object> pair in dictionary2)
                    {
                        dictionary.Add(pair.Key, new InstanceValue(pair.Value));
                    }
                }
            }
            return(dictionary);
        }
        private static Dictionary <XName, object> ReadLockOwnerMetadata(SqlDataReader reader)
        {
            Dictionary <XName, object> dictionary = new Dictionary <XName, object>();
            InstanceEncodingOption     @byte      = (InstanceEncodingOption)reader.GetByte(3);

            byte[]            bytes            = reader.IsDBNull(4) ? null : ((byte[])reader.GetValue(4));
            byte[]            buffer2          = reader.IsDBNull(5) ? null : ((byte[])reader.GetValue(5));
            IObjectSerializer objectSerializer = ObjectSerializerFactory.GetObjectSerializer(@byte);

            Dictionary <XName, object>[] dictionaryArray = new Dictionary <XName, object> [2];
            if (bytes != null)
            {
                dictionaryArray[0] = (Dictionary <XName, object>)objectSerializer.DeserializeValue(bytes);
            }
            if (buffer2 != null)
            {
                dictionaryArray[1] = objectSerializer.DeserializePropertyBag(buffer2);
            }
            foreach (Dictionary <XName, object> dictionary2 in dictionaryArray)
            {
                if (dictionary2 != null)
                {
                    foreach (KeyValuePair <XName, object> pair in dictionary2)
                    {
                        dictionary.Add(pair.Key, pair.Value);
                    }
                }
            }
            return(dictionary);
        }