Beispiel #1
0
        public Payload ExtractPayload()
        {
            var payload = new Payload();

            if (Classes?.Contains(ClassNames.Error) == true)
            {
                payload.Error = new Record
                {
                    Classes    = GetUserClasses(this.Classes),
                    Properties = new PropertyCollection(DataProperties.Select(x => x.Clone()))
                };
            }
            else
            {
                if (Classes?.Contains(ClassNames.Form) == true)
                {
                    payload.Form = new Record
                    {
                        Classes    = GetUserClasses(this.Classes),
                        Properties = new PropertyCollection(DataProperties.Select(x => x.Clone()))
                    };
                }

                payload.Records = ExtractRecords(this).ToArray();
            }

            return(payload);
        }
Beispiel #2
0
        public override object ToMinified()
        {
            var rs = NavigationProperties.Select(np => np.ToMinified()).ToList();
            var xs = ComplexProperties.Select(cp => cp.ToMinified()).ToList();

            return(new {
                n = Name,
                rn = ResourceName,
                l = GetDisplayName(),
                s = ShortName,
                q = QueryName,
                t = QueryType,
                b = BaseTypeName,
                c = IsComplexType,
                k = Keys,
                d = DataProperties.Select(dp => dp.ToMinified()).ToList(),
                r = rs.Any() ? rs : null,
                x = xs.Any() ? xs : null
            });
        }