Пример #1
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);
        }
Пример #2
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jo = new JNode();

            jo.AddPrimitive("name", this.Name);
            jo.AddPrimitive("entityTypeName", this.EntityTypeName);
            jo.AddPrimitive("isScalar", this.IsScalar);
            jo.AddPrimitive("associationName", this.AssociationName);
            // jo.AddArray("validators", this.Validators);
            jo.AddArray("foreignKeyNames", this.ForeignKeyNames);
            jo.AddArray("invForeignKeyNames", this.InvForeignKeyNames);
            // jo.Add("custom", this.Custom.ToJObject)
            return(jo);
        }
Пример #3
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jo = new JNode();

            jo.AddPrimitive("shortName", this.ShortName);
            jo.AddPrimitive("namespace", this.Namespace);
            jo.AddPrimitive("baseTypeName", this.BaseTypeName);
            jo.AddPrimitive("isAbstract", this.IsAbstract, false);
            jo.AddPrimitive("autoGeneratedKeyType", this.AutoGeneratedKeyType.ToString());
            jo.AddPrimitive("defaultResourceName", this.DefaultResourceName);
            jo.AddArray("dataProperties", this.DataProperties.Where(dp => dp.IsInherited == false));
            jo.AddArray("navigationProperties", this.NavigationProperties.Where(np => np.IsInherited == false));
            // jo.AddArrayProperty("validators", this.Validators);
            // jo.AddProperty("custom", this.Custom.ToJObject)
            return(jo);
        }
Пример #4
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);
        }
Пример #5
0
        private JNode PrepareSaveBundle(IEnumerable <IEntity> entitiesToSave, SaveOptions saveOptions)
        {
            var jn = new JNode();

            jn.AddArray("entities", entitiesToSave.Select(e => EntityToJNode(e)));
            jn.AddJNode("saveOptions", saveOptions);
            return(jn);
        }
Пример #6
0
        JNode IJsonSerializable.ToJNode(object config)
        {
            var jn = new JNode();

            jn.AddPrimitive("entityType", this.EntityType.Name);
            jn.AddArray("values", this.Values);

            return(jn);
        }
Пример #7
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);
        }
Пример #8
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jo = new JNode();

            jo.AddPrimitive("shortName", this.ShortName);
            jo.AddPrimitive("namespace", this.Namespace);
            jo.AddPrimitive("isComplexType", true);
            // jo.AddProperty("baseTypeName", this.BaseTypeName);
            // jo.AddProperty("isAbstract", this.IsAbstract, false);
            jo.AddArray("dataProperties", this.DataProperties.Where(dp => dp.IsInherited == false));
            // jo.AddArrayProperty("validators", this.Validators);
            // jo.AddProperty("custom", this.Custom.ToJObject)
            return(jo);
        }
Пример #9
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jn = new JNode();

            jn.AddPrimitive("name", this.Name);
            jn.AddPrimitive("dataType", this.DataType != null ? this.DataType.Name : null);
            jn.AddPrimitive("complexTypeName", this.ComplexType != null ? this.ComplexType.Name : null);
            jn.AddPrimitive("isNullable", this.IsNullable, true);
            jn.AddPrimitive("defaultValue", this.DefaultValue);
            jn.AddPrimitive("isPartOfKey", this.IsPartOfKey, false);
            jn.AddPrimitive("isUnmapped", this.IsUnmapped, false);
            jn.AddPrimitive("isAutoIncrementing", this.IsAutoIncrementing, false);
            jn.AddPrimitive("concurrencyMode", this.ConcurrencyMode == ConcurrencyMode.None ? null : this.ConcurrencyMode.ToString());
            jn.AddPrimitive("maxLength", this.MaxLength);
            jn.AddArray("validators", this.Validators);
            jn.AddPrimitive("enumType", this.EnumTypeName);
            jn.AddPrimitive("isScalar", this.IsScalar, true);
            // jo.AddProperty("custom", this.Custom.ToJObject)
            return(jn);
        }