Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            PrimitiveList entryOther = obj as PrimitiveList;

            if (entryOther == null || this.Type != entryOther.Type)
            {
                return(false);
            }

            if (entryOther.Entries.Count != this.Entries.Count)
            {
                return(false);
            }

            for (int i = 0; i < this.Entries.Count; i++)
            {
                Primitive thisPrim  = this[i];
                Primitive otherPrim = entryOther[i];

                if (thisPrim == null && otherPrim == null)
                {
                    continue;
                }
                else if (thisPrim == null || otherPrim == null)
                {
                    return(false);
                }
                else if (!thisPrim.Equals(otherPrim))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
 internal static DynamoDBEntry AttributeValueToDynamoDBEntry(AttributeValue value)
 {
     if (value.S != null)
     {
         return(value.S);
     }
     else if (value.N != null)
     {
         Primitive primitive = value.N;
         primitive.SaveAsNumeric = true;
         return(primitive);
     }
     else if (value.SS != null && value.SS.Count != 0)
     {
         return(value.SS);
     }
     else if (value.NS != null && value.NS.Count != 0)
     {
         PrimitiveList primitiveList = value.NS;
         primitiveList.SaveAsNumeric = true;
         return(primitiveList);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
        internal static DynamoDBEntry AttributeValueToDynamoDBEntry(AttributeValue attributeValue)
        {
            Primitive primitive = null;

            if (attributeValue.S != null)
            {
                primitive = new Primitive(attributeValue.S);
            }
            else if (attributeValue.N != null)
            {
                primitive = new Primitive(attributeValue.N, true);
            }
            else if (attributeValue.B != null)
            {
                primitive = new Primitive(attributeValue.B);
            }
            if (primitive != null)
            {
                return(primitive);
            }

            PrimitiveList primitiveList = null;

            if (attributeValue.SS != null && attributeValue.SS.Count != 0)
            {
                primitiveList = new PrimitiveList(DynamoDBEntryType.String);
                foreach (string item in attributeValue.SS)
                {
                    primitive = new Primitive(item);
                    primitiveList.Add(primitive);
                }
            }
            else if (attributeValue.NS != null && attributeValue.NS.Count != 0)
            {
                primitiveList = new PrimitiveList(DynamoDBEntryType.Numeric);
                foreach (string item in attributeValue.NS)
                {
                    primitive = new Primitive(item, true);
                    primitiveList.Add(primitive);
                }
            }
            else if (attributeValue.BS != null && attributeValue.BS.Count != 0)
            {
                primitiveList = new PrimitiveList(DynamoDBEntryType.Binary);
                foreach (MemoryStream item in attributeValue.BS)
                {
                    primitive = new Primitive(item);
                    primitiveList.Add(primitive);
                }
            }

            if (primitiveList != null)
            {
                return(primitiveList);
            }

            return(null);
        }
Ejemplo n.º 4
0
        public override object Clone()
        {
            PrimitiveList list = new PrimitiveList(this.Type);

            foreach (Primitive entry in this.Entries)
            {
                list.Add(entry.Clone() as Primitive);
            }

            return(list);
        }
Ejemplo n.º 5
0
        public override object Clone()
        {
            List <Primitive> values = new List <Primitive>();

            foreach (Primitive entry in this.Entries)
            {
                values.Add(entry.Clone() as Primitive);
            }

            PrimitiveList list = new PrimitiveList(this.SaveAsNumeric);

            list.Entries = values;
            return(list);
        }
Ejemplo n.º 6
0
        internal static DynamoDBEntry AttributeValueToDynamoDBEntry(AttributeValue attributeValue)
        {
            Primitive primitive = null;
            if (attributeValue.S != null)
            {
                primitive = new Primitive(attributeValue.S);
            }
            else if (attributeValue.N != null)
            {
                primitive = new Primitive(attributeValue.N, true);
            }
            else if (attributeValue.B != null)
            {
                primitive = new Primitive(attributeValue.B);
            }
            if (primitive != null)
                return primitive;

            PrimitiveList primitiveList = null;
            if (attributeValue.SS != null && attributeValue.SS.Count != 0)
            {
                primitiveList = new PrimitiveList(DynamoDBEntryType.String);
                foreach (string item in attributeValue.SS)
                {
                    primitive = new Primitive(item);
                    primitiveList.Add(primitive);
                }
            }
            else if (attributeValue.NS != null && attributeValue.NS.Count != 0)
            {
                primitiveList = new PrimitiveList(DynamoDBEntryType.Numeric);
                foreach (string item in attributeValue.NS)
                {
                    primitive = new Primitive(item, true);
                    primitiveList.Add(primitive);
                }
            }
            else if (attributeValue.BS != null && attributeValue.BS.Count != 0)
            {
                primitiveList = new PrimitiveList(DynamoDBEntryType.Binary);
                foreach (MemoryStream item in attributeValue.BS)
                {
                    primitive = new Primitive(item);
                    primitiveList.Add(primitive);
                }
            }

            if (primitiveList != null)
                return primitiveList;

            return null;
        }
Ejemplo n.º 7
0
        public override object Clone()
        {
            PrimitiveList list = new PrimitiveList(this.Type);
            foreach (Primitive entry in this.Entries)
            {
                list.Add(entry.Clone() as Primitive);
            }

            return list;
        }
Ejemplo n.º 8
0
        public override object Clone()
        {
            List<Primitive> values = new List<Primitive>();
            foreach (Primitive entry in this.Entries)
            {
                values.Add(entry.Clone() as Primitive);
            }

            PrimitiveList list = new PrimitiveList(this.SaveAsNumeric);
            list.Entries = values;
            return list;
        }