Example #1
0
        private JSField GetArrayField(JSField field, string name)
        {
            JSObject fieldObject = (JSObject)field.GetValue(field);
            FieldInfo[] fields = fieldObject.GetFields(BindingFlags.Default);

            for (int i = 0; i < fields.Length; i++)
            {
                JSField indexField = (JSField)fields[i];
                if (indexField.Name == name)
                    return indexField;
            }

            return null;
        }
Example #2
0
        internal PayloadComplexProperty parseComplexObject(PayloadObject parent, JSField field)
        {
            PayloadComplexProperty payloadProperty = new PayloadComplexProperty(parent);
            payloadProperty.Name = field.Name;

            JSObject fieldValue = (JSObject)field.GetValue(field);
            FieldInfo[] fieldInfo = fieldValue.GetFields(BindingFlags.Default);

            for (int j = 0; j < fieldInfo.Length; j++)
            {
                JSField currentField = (JSField)fieldInfo[j];

                if (currentField.GetValue(currentField) is JSObject)
                {
                    PayloadComplexProperty payloadComplexProperty = this.parseComplexObject(parent, (JSField)fieldInfo[j]);
                    payloadProperty.PayloadProperties.Add(payloadComplexProperty.Name, payloadComplexProperty);
                }
                else
                {
                    PayloadProperty payloadSimpleProperty = this.parseSimpleObject(parent, (JSField)fieldInfo[j]);
                    payloadProperty.PayloadProperties.Add(payloadSimpleProperty.Name, payloadSimpleProperty);
                }
            }

            return payloadProperty;
        }
Example #3
0
        private JSField GetArrayField(JSField field, int index)
        {
            JSObject fieldObject = (JSObject)field.GetValue(field);
            FieldInfo[] fields = fieldObject.GetFields(BindingFlags.Default);
            JSField indexField = (JSField)fields[index];

            return indexField;
        }
Example #4
0
        internal PayloadSimpleProperty parseSimpleObject(PayloadObject parent, JSField field)
        {
            PayloadSimpleProperty payloadProperty = new PayloadSimpleProperty(parent);
            payloadProperty.Name = field.Name;

            object val = field.GetValue(field);

            if (val is System.DBNull)
            {
                payloadProperty.Value = null;
                payloadProperty.Type = null;
                payloadProperty.IsNull = true;
            }
            else
            {
                payloadProperty.Type = AstoriaUnitTests.Data.TypeData.FindForType(val.GetType()).GetEdmTypeName();
                payloadProperty.Value = ConvertJsonValue(val);
                payloadProperty.IsNull = false;
            }

            return payloadProperty;
        }