Example #1
0
        private JNode ExportComplexAspectInfo(ComplexAspect complexAspect)
        {
            var jn = new JNode();

            jn.AddMap("originalValuesMap", complexAspect._originalValuesMap);
            return(jn);
        }
Example #2
0
        private JNode ExportEntityGroupsAndTempKeys(IEnumerable <IEntity> entities)
        {
            Dictionary <String, IEnumerable <JNode> > map;
            IEnumerable <EntityAspect> aspects;

            if (entities != null)
            {
                aspects = entities.Select(e => e.EntityAspect);
                map     = aspects.GroupBy(ea => ea.EntityGroup.EntityType).ToDictionary(grp => grp.Key.Name, grp => ExportAspects(grp, grp.Key));
            }
            else
            {
                aspects = this.EntityGroups.SelectMany(eg => eg.EntityAspects);
                map     = this.EntityGroups.ToDictionary(eg => eg.EntityType.Name, eg => ExportAspects(eg, eg.EntityType));
            }

            var tempKeys = aspects.Where(ea => ea.HasTemporaryKey).Select(ea => ea.EntityKey);

            var jn = new JNode();

            // entityGroup map is map of entityTypeName: array of serialized entities;
            jn.AddMap("entityGroupMap", map);
            jn.AddArray("tempKeys", tempKeys);
            return(jn);
        }
Example #3
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jo = new JNode();

            jo.AddPrimitive("metadataVersion", MetadataVersion);
            // jo.Add("name", this.Name);
            jo.AddPrimitive("namingConvention", this.NamingConvention.Name);
            // jo.AddProperty("localQueryComparisonOptions", this.LocalQueryComparisonOptions);
            jo.AddArray("dataServices", this._dataServiceMap.Values);
            jo.AddArray("structuralTypes", this._structuralTypes);
            jo.AddMap("resourceEntityTypeMap", this._resourceNameEntityTypeMap.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Name));
            return(jo);
        }
Example #4
0
        private JNode ExportEntityAspectInfo(EntityAspect entityAspect)
        {
            var jn = new JNode();
            var es = entityAspect.EntityState;

            jn.AddEnum("entityState", entityAspect.EntityState);
            jn.AddArray("tempNavPropNames", GetTempNavPropNames(entityAspect));
            if (es.IsModified() || es.IsDeleted())
            {
                jn.AddMap("originalValuesMap", entityAspect._originalValuesMap);
            }
            return(jn);
        }