private void DeserializeFrom(JNode jNode)
        {
            MetadataVersion = jNode.Get <String>("metadataVersion");
            // may be more than just a name

            var ncNode = jNode.GetJNode("namingConvention");
            var nc     = FindOrCreateNamingConvention(ncNode);

            if (nc == null)
            {
                OnMetadataMismatch(null, null, MetadataMismatchType.MissingCLRNamingConvention, ncNode.ToString());
            }
            else
            {
                NamingConvention = nc;
            }

            // localQueryComparisonOptions
            jNode.GetJNodeArray("dataServices").Select(jn => new DataService(jn)).ForEach(ds => {
                if (GetDataService(ds.ServiceName) == null)
                {
                    AddDataService(ds);
                }
            });
            jNode.GetJNodeArray("structuralTypes")
            .ForEach(UpdateStructuralTypeFromJNode);

            jNode.GetMap <String>("resourceEntityTypeMap").ForEach(kvp => {
                var et = GetEntityType(kvp.Value);
                SetResourceName(kvp.Key, et);
            });
        }
示例#2
0
        private void DeserializeFrom(JNode jNode, bool isFromServer)
        {
            MetadataVersion = jNode.Get <String>("metadataVersion");
            // may be more than just a name

            var ncNode = jNode.GetJNode("namingConvention");

            if (ncNode != null)
            {
                var nc = Configuration.Instance.FindOrCreateNamingConvention(ncNode);
                if (nc == null)
                {
                    OnMetadataMismatch(null, null, MetadataMismatchTypes.MissingCLRNamingConvention, ncNode.ToString());
                }
                else
                {
                    // keep any preexisting ClientServerNamespaceMap info
                    NamingConvention = nc.WithClientServerNamespaceMapping(this.NamingConvention.ClientServerNamespaceMap);
                }
            }

            // localQueryComparisonOptions
            jNode.GetJNodeArray("dataServices").Select(jn => new DataService(jn)).ForEach(ds => {
                if (GetDataService(ds.ServiceName) == null)
                {
                    AddDataService(ds);
                }
            });
            jNode.GetJNodeArray("structuralTypes")
            .ForEach(jn => UpdateStructuralTypeFromJNode(jn, isFromServer));

            jNode.GetMap <String>("resourceEntityTypeMap").ForEach(kvp => {
                var stName = kvp.Value;
                if (isFromServer)
                {
                    stName = TypeNameInfo.FromStructuralTypeName(stName).ToClient(this).StructuralTypeName;
                }
                // okIfNotFound because metadata may contain refs to types that were already excluded earlier in
                // UpdateStructuralTypeFromJNode
                var et = GetEntityType(stName, true);
                if (et != null)
                {
                    SetResourceName(kvp.Key, et);
                }
            });
        }
示例#3
0
        private void DeserializeFrom(JNode jNode)
        {
            MetadataVersion = jNode.Get <String>("metadataVersion");
            // Name
            NamingConvention = NamingConvention.FromName(jNode.Get <String>("namingConvention"));
            // localQueryComparisonOptions
            jNode.GetJNodeArray("dataServices").Select(jn => new DataService(jn)).ForEach(ds => {
                if (GetDataService(ds.ServiceName) == null)
                {
                    AddDataService(ds);
                }
            });
            jNode.GetJNodeArray("structuralTypes")
            .ForEach(UpdateStructuralTypeFromJNode);

            jNode.GetMap <String>("resourceEntityTypeMap").ForEach(kvp => {
                var et = GetEntityType(kvp.Value);
                SetResourceName(kvp.Key, et);
            });
        }