コード例 #1
0
        /// <summary>
        ///     Retrieve the root "Schema" node for current node.  If there is no root mapping node, this will return null.
        /// </summary>
        internal override XNamespace GetRootNamespace(EFObject node)
        {
            var currNode = node;
            EFRuntimeModelRoot runtimeModel = null;
            EFDesignerInfoRoot designerInfo = null;
            XNamespace         ns           = null;

            while (currNode != null)
            {
                runtimeModel = currNode as EFRuntimeModelRoot;
                designerInfo = currNode as EFDesignerInfoRoot;

                if (runtimeModel != null)
                {
                    ns = runtimeModel.XNamespace;
                    break;
                }
                else if (designerInfo != null)
                {
                    ns = designerInfo.XNamespace;
                    break;
                }
                else
                {
                    currNode = currNode.Parent;
                }
            }

            return(ns);
        }
コード例 #2
0
        private static bool CompareNamespaces(EFRuntimeModelRoot rootNode, XNamespace xnamespace)
        {
            Debug.Assert(xnamespace != null, "xnamespace != null");
            Debug.Assert(rootNode == null || rootNode.XNamespace != null, "invalid model root namespace");

            return(rootNode == null || rootNode.XNamespace == xnamespace);
        }
コード例 #3
0
        private static string GetSchemaFromRuntimeModelRoot(EFRuntimeModelRoot modelRoot)
        {
            Debug.Assert(modelRoot != null, "EFRuntimeModelRoot is null ");
            Debug.Assert(modelRoot.XElement != null,
                         "Could not find the runtime model root or its XElement in GetSchemaFromRuntimeModelRoot");

            var sb = new StringBuilder();

            if (modelRoot != null &&
                modelRoot.XElement != null)
            {
                using (var writer = new StringWriter(sb, CultureInfo.CurrentCulture))
                {
                    modelRoot.XElement.Save(writer);
                }
            }

            return(sb.ToString());
        }
コード例 #4
0
        private static bool CompareNamespaces(EFRuntimeModelRoot rootNode, XNamespace xnamespace)
        {
            Debug.Assert(xnamespace != null, "xnamespace != null");
            Debug.Assert(rootNode == null || rootNode.XNamespace != null, "invalid model root namespace");

            return rootNode == null || rootNode.XNamespace == xnamespace;
        }
コード例 #5
0
        private static string GetSchemaFromRuntimeModelRoot(EFRuntimeModelRoot modelRoot)
        {
            Debug.Assert(modelRoot != null, "EFRuntimeModelRoot is null ");
            Debug.Assert(modelRoot.XElement != null,
                "Could not find the runtime model root or its XElement in GetSchemaFromRuntimeModelRoot");

            var sb = new StringBuilder();

            if (modelRoot != null
                && modelRoot.XElement != null)
            {
                using (var writer = new StringWriter(sb, CultureInfo.CurrentCulture))
                {
                    modelRoot.XElement.Save(writer);
                }
            }

            return sb.ToString();
        }