1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //------------------------------------------------------------
4 
5 namespace System.ServiceModel.Description
6 {
7     using System;
8     using System.Globalization;
9     using System.ServiceModel;
10     using System.ServiceModel.Dispatcher;
11     using System.ServiceModel.Channels;
12     using System.Collections.Generic;
13     using System.Diagnostics;
14     using System.ServiceModel.Web;
15     using System.Text;
16     using System.Xml;
17 
18     [DebuggerDisplay("Address={address}")]
19     [DebuggerDisplay("Name={name}")]
20     public class WebScriptEndpoint : WebServiceEndpoint
21     {
22         static Type WebScriptEndpointType = typeof(WebScriptEndpoint);
23 
WebScriptEndpoint(ContractDescription contract)24         public WebScriptEndpoint(ContractDescription contract) :
25             this(contract, null /* address */)
26         { }
27 
WebScriptEndpoint(ContractDescription contract, EndpointAddress address)28         public WebScriptEndpoint(ContractDescription contract, EndpointAddress address)
29             : base(contract, address)
30         {
31             this.Behaviors.Add(new WebScriptEnablingBehavior());
32         }
33 
34         WebScriptEnablingBehavior webScriptEnablingBehavior
35         {
36             get
37             {
38                 WebScriptEnablingBehavior webScriptEnablingBehavior = this.Behaviors.Find<WebScriptEnablingBehavior>();
39                 if (webScriptEnablingBehavior == null)
40                 {
41                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.GetString(SR2.WebBehaviorNotFoundWithEndpoint, WebEndpointType.Name, typeof(WebScriptEnablingBehavior).Name)));
42                 }
43                 return webScriptEnablingBehavior;
44             }
45         }
46 
47         protected override Type WebEndpointType
48         {
49             get { return WebScriptEndpointType; }
50         }
51     }
52 
53 }
54