Exemplo n.º 1
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jo = new JNode();

            jo.AddPrimitive("name", this.Name);
            jo.AddPrimitive("entityTypeName", this.EntityType.Name);
            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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 JNode IJsonSerializable.ToJNode(Object config)
 {
     lock (_structuralTypes) {
         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);
     }
 }
Exemplo n.º 4
0
        //public SaveOptions(JNode jNode) {


        //}

        JNode IJsonSerializable.ToJNode(object config)
        {
            var jn = new JNode();

            jn.AddPrimitive("tag", Tag);
            return(jn);
        }
Exemplo n.º 5
0
        JNode IJsonSerializable.ToJNode(object config)
        {
            var jn = new JNode();

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

            return(jn);
        }
Exemplo n.º 6
0
        private JNode BuildEntityAspectNode(EntityAspect entityAspect)
        {
            var nc         = entityAspect.EntityManager.MetadataStore.NamingConvention;
            var jn         = new JNode();
            var entityType = entityAspect.EntityType;

            jn.AddPrimitive("entityTypeName", entityType.NameOnServer);
            jn.AddEnum("entityState", entityAspect.EntityState);
            jn.AddPrimitive("defaultResourceName", entityType.DefaultResourceName);
            jn.AddJNode("originalValuesMap", BuildOriginalValuesMapNode(entityAspect, nc));
            var agkType = entityType.AutoGeneratedKeyType;

            if (agkType != AutoGeneratedKeyType.None)
            {
                var agkNode = new JNode();
                agkNode.AddPrimitive("propertyName", entityType.KeyProperties[0].Name);
                agkNode.AddEnum("autoGeneratedKeyType", agkType);
                jn.AddJNode("autoGeneratedKey", agkNode);
            }
            return(jn);
        }
Exemplo n.º 7
0
        private JNode DataToJNode(StructuralAspect aspect)
        {
            var jn    = new JNode();
            var stype = aspect.StructuralType;

            stype.DataProperties.ForEach(dp => {
                var val = aspect.GetValue(dp.Name);
                // handle nonscalar dps
                if (dp.IsComplexProperty)
                {
                    jn.AddJNode(dp.NameOnServer, DataToJNode(((IComplexObject)val).ComplexAspect));
                }
                else
                {
                    jn.AddPrimitive(dp.NameOnServer, val, TypeFns.GetDefaultValue(dp.DataType.ClrType));
                }
            });
            return(jn);
        }
Exemplo n.º 8
0
        private JNode DataToJNode(StructuralAspect aspect)
        {
            var jn    = new JNode();
            var stype = aspect.StructuralType;

            stype.DataProperties.ForEach(dp => {
                var val = aspect.GetValue(dp.Name);
                // handle nonscalar dps
                if (dp.IsComplexProperty)
                {
                    jn.AddJNode(dp.NameOnServer, DataToJNode(((IComplexObject)val).ComplexAspect));
                }
                else
                {
                    // always add the val even if equal to the default
                    jn.AddPrimitive(dp.NameOnServer, val);
                }
            });
            return(jn);
        }
Exemplo n.º 9
0
        JNode IJsonSerializable.ToJNode(Object config)
        {
            var jo = new JNode();

            jo.AddPrimitive("shortName", this.ShortName);
            jo.AddPrimitive("namespace", this.Namespace);
            jo.AddPrimitive("baseTypeName", this.BaseEntityTypeName);
            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.AddArray("validators", this.Validators);
            // jo.AddProperty("custom", this.Custom.ToJObject)
            return(jo);
        }
Exemplo n.º 10
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.AddPrimitive("isScalar", this.IsScalar, true);
            jn.AddArray("validators", this.Validators);
            jn.AddPrimitive("enumType", this.EnumTypeName);
            // jo.AddProperty("custom", this.Custom.ToJObject)
            return(jn);
        }