/// <summary> /// Update entity model based on csdl sent back from server. /// </summary> /// <param name="continuation">The async continuation</param> protected override void UpdateEntityModel(IAsyncContinuation continuation) { #if !SILVERLIGHT // get CSDL contents List <string> csdlContent = new List <string>(); foreach (var key in this.CurrentWorkspace.WorkspaceInfo.AdditionalProviderInfo.Keys.Where(k => k.StartsWith(AstoriaWorkspaceInfoConstants.CsdlKeyPrefix, StringComparison.OrdinalIgnoreCase))) { string content; ExceptionUtilities.Assert(this.CurrentWorkspace.WorkspaceInfo.AdditionalProviderInfo.TryGetValue(key, out content), "Cannot get csdl content with key {0}.", key); csdlContent.Add(content); } // preserve Annotations which were not serialised var functionAnnotationPreserver = new FunctionAnnotationPreserver(); functionAnnotationPreserver.PreserveFunctionAnnotations(this.CurrentWorkspace.ConceptualModel.Functions); // parse CSDL into EntityModelSchema XElement[] xelements = csdlContent.Select(XElement.Parse).ToArray(); this.CurrentWorkspace.ConceptualModel = this.CsdlParser.Parse(xelements); CustomAnnotationConverter customAnnotationConverter = new CustomAnnotationConverter(); customAnnotationConverter.AnnotationAssemblies.Add(typeof(TypeBackedAnnotation).GetAssembly()); customAnnotationConverter.AnnotationNamespaces.Add(typeof(TypeBackedAnnotation).Namespace); customAnnotationConverter.ConvertAnnotations(this.CurrentWorkspace.ConceptualModel); functionAnnotationPreserver.RestoreFunctionAnnotations(this.CurrentWorkspace.ConceptualModel.Functions); #endif base.UpdateEntityModel(continuation); }
/// <summary> /// Update entity model based on csdl sent back from server. /// </summary> /// <param name="continuation">The async continuation</param> protected override void UpdateEntityModel(IAsyncContinuation continuation) { #if !SILVERLIGHT // get CSDL contents List<string> csdlContent = new List<string>(); foreach (var key in this.CurrentWorkspace.WorkspaceInfo.AdditionalProviderInfo.Keys.Where(k => k.StartsWith(AstoriaWorkspaceInfoConstants.CsdlKeyPrefix, StringComparison.OrdinalIgnoreCase))) { string content; ExceptionUtilities.Assert(this.CurrentWorkspace.WorkspaceInfo.AdditionalProviderInfo.TryGetValue(key, out content), "Cannot get csdl content with key {0}.", key); csdlContent.Add(content); } // preserve Annotations which were not serialised var functionAnnotationPreserver = new FunctionAnnotationPreserver(); functionAnnotationPreserver.PreserveFunctionAnnotations(this.CurrentWorkspace.ConceptualModel.Functions); // parse CSDL into EntityModelSchema XElement[] xelements = csdlContent.Select(XElement.Parse).ToArray(); this.CurrentWorkspace.ConceptualModel = this.CsdlParser.Parse(xelements); CustomAnnotationConverter customAnnotationConverter = new CustomAnnotationConverter(); customAnnotationConverter.AnnotationAssemblies.Add(typeof(TypeBackedAnnotation).GetAssembly()); customAnnotationConverter.AnnotationNamespaces.Add(typeof(TypeBackedAnnotation).Namespace); customAnnotationConverter.ConvertAnnotations(this.CurrentWorkspace.ConceptualModel); functionAnnotationPreserver.RestoreFunctionAnnotations(this.CurrentWorkspace.ConceptualModel.Functions); #endif base.UpdateEntityModel(continuation); }