mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
//------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//------------------------------------------------------------
|
|
namespace System.ServiceModel.XamlIntegration
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ServiceModel.Dispatcher;
|
|
using System.Windows.Markup;
|
|
|
|
[ContentProperty("Namespaces")]
|
|
public class XPathMessageContextMarkupExtension : MarkupExtension
|
|
{
|
|
static List<string> implicitPrefixes;
|
|
Dictionary<string, string> namespaces;
|
|
|
|
static XPathMessageContextMarkupExtension()
|
|
{
|
|
implicitPrefixes = new List<string>();
|
|
|
|
foreach (string prefix in XPathMessageContext.defaultNamespaces.Keys)
|
|
{
|
|
implicitPrefixes.Add(prefix);
|
|
}
|
|
|
|
implicitPrefixes.Add("");
|
|
implicitPrefixes.Add("xml");
|
|
implicitPrefixes.Add("xmlns");
|
|
}
|
|
|
|
public XPathMessageContextMarkupExtension()
|
|
{
|
|
this.namespaces = new Dictionary<string, string>();
|
|
}
|
|
|
|
public XPathMessageContextMarkupExtension(XPathMessageContext context)
|
|
: this()
|
|
{
|
|
foreach (string prefix in context)
|
|
{
|
|
if (!implicitPrefixes.Contains(prefix))
|
|
{
|
|
this.namespaces.Add(prefix, context.LookupNamespace(prefix));
|
|
}
|
|
}
|
|
}
|
|
|
|
public Dictionary<string, string> Namespaces
|
|
{
|
|
get { return this.namespaces; }
|
|
}
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
{
|
|
XPathMessageContext context = new XPathMessageContext();
|
|
|
|
foreach (KeyValuePair<string, string> ns in this.namespaces)
|
|
{
|
|
context.AddNamespace(ns.Key, ns.Value);
|
|
}
|
|
|
|
return context;
|
|
}
|
|
}
|
|
}
|