Exemplo n.º 1
0
        protected override void Serialize(IDictionary <string, object> json)
        {
            if (FunctionData.HasValue())
            {
                json.Add("data", FunctionData);
            }
            else
            {
                FluentDictionary.For(json).Add("data", Data, string.Empty);
            }

            if (FunctionTotal.HasValue())
            {
                json.Add("total", FunctionTotal);
            }
            else
            {
                FluentDictionary.For(json).Add("total", Total, string.Empty);
            }

            if (FunctionErrors.HasValue())
            {
                json.Add("errors", FunctionErrors);
            }
            else
            {
                FluentDictionary.For(json).Add("errors", Errors, string.Empty);
            }

            if (FunctionAggregates.HasValue())
            {
                json.Add("aggregates", FunctionAggregates);
            }
            else
            {
                FluentDictionary.For(json).Add("aggregates", Aggregates, string.Empty);
            }

            if (FunctionGroups.HasValue())
            {
                json.Add("groups", FunctionGroups);
            }
            else
            {
                FluentDictionary.For(json).Add("groups", Groups, string.Empty);
            }

            if (Model != null)
            {
                json.Add("model", Model.ToJson());
            }

            if (!string.IsNullOrEmpty(Type))
            {
                json.Add("type", Type);
            }

            if (Parse.HasValue())
            {
                json.Add("parse", Parse);
            }
        }