/
GenerateScriptTypeAttribute.xml
157 lines (136 loc) · 10.4 KB
/
GenerateScriptTypeAttribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<Type Name="GenerateScriptTypeAttribute" FullName="System.Web.Script.Services.GenerateScriptTypeAttribute">
<TypeSignature Language="C#" Value="public sealed class GenerateScriptTypeAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit GenerateScriptTypeAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.Web.Script.Services.GenerateScriptTypeAttribute" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class GenerateScriptTypeAttribute
Inherits Attribute" />
<TypeSignature Language="F#" Value="type GenerateScriptTypeAttribute = class
 inherit Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class GenerateScriptTypeAttribute sealed : Attribute" />
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Specifies that the server type must be generated in the proxy object. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
In AJAX-enabled ASP.NET Web sites, ASP.NET can automatically generate proxy objects for methods of a Web service class. It does this for most top-level types for the input parameters and return values of any Web methods that are marked with <xref:System.Web.Script.Services.ScriptServiceAttribute>.
In other cases, if you proxy objects generated for server types, you must apply <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> manually. You can apply <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> to the Web service itself or to any Web service method or `static` page method marked with <xref:System.Web.Services.WebMethodAttribute>.
In some cases, even if the type corresponds to an input parameter or return value of a Web service method, the proxy will not be generated automatically. In that case, you must use the <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> attribute to generate the proxy object for the type. This occurs for generic types and arrays that have more than one argument, such as `Dictionary<string,<T>>`.
One or more instances of <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> can be applied to a Web service class or method. ASP.NET will then generate an ECMAScript (JavaScript) proxy class for each top-level type that is referenced by each declaration of <xref:System.Web.Script.Services.GenerateScriptTypeAttribute>.
> [!NOTE]
> If you want to generate proxy objects for nested types, you must manually apply <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> to each nested type. ASP.NET generates proxies only for top-level types and does not automatically recursively apply the attribute to nested types.
For more information about how to use attributes, see [Attributes](/dotnet/standard/attributes/).
## Examples
The following example shows how to apply <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> to a Web service class and to a Web method. As a result, the `ColorObject` type and its nested type `FavoriteColors` are included in the proxy object.
]]></format>
</remarks>
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/bb515101(v=vs.100)">Using Web Services in ASP.NET AJAX</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/bb398995(v=vs.100)">Calling Web Services from Client Script in ASP.NET AJAX</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public GenerateScriptTypeAttribute (Type type);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type type) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Script.Services.GenerateScriptTypeAttribute.#ctor(System.Type)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (type As Type)" />
<MemberSignature Language="F#" Value="new System.Web.Script.Services.GenerateScriptTypeAttribute : Type -> System.Web.Script.Services.GenerateScriptTypeAttribute" Usage="new System.Web.Script.Services.GenerateScriptTypeAttribute type" />
<MemberSignature Language="C++ CLI" Value="public:
 GenerateScriptTypeAttribute(Type ^ type);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="type" Type="System.Type" />
</Parameters>
<Docs>
<param name="type">The type to include in the proxy class.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.Script.Services.GenerateScriptTypeAttribute" /> class for the specified type.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.Script.Services.GenerateScriptTypeAttribute.ScriptTypeId%2A> property is an optional named parameter for this constructor.
## Examples
The following example shows how to use <xref:System.Web.Script.Services.GenerateScriptTypeAttribute> to generate a proxy object for the specified type that uses a specific type identifier for the metadata marker.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="type" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="ScriptTypeId">
<MemberSignature Language="C#" Value="public string ScriptTypeId { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string ScriptTypeId" />
<MemberSignature Language="DocId" Value="P:System.Web.Script.Services.GenerateScriptTypeAttribute.ScriptTypeId" />
<MemberSignature Language="VB.NET" Value="Public Property ScriptTypeId As String" />
<MemberSignature Language="F#" Value="member this.ScriptTypeId : string with get, set" Usage="System.Web.Script.Services.GenerateScriptTypeAttribute.ScriptTypeId" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ ScriptTypeId { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the type identifier for the type metadata marker.</summary>
<value>The type identifier for the type metadata marker on the serialized JavaScript Object Notation (JSON) string. The default value is the assembly-qualified name of the type.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This is an optional property. If specified, the value of <xref:System.Web.Script.Services.GenerateScriptTypeAttribute.ScriptTypeId%2A> is used for the type metadata marker ("__type") on the serialized JSON string instead of the assembly-qualified name of the type. During deserialization, the type resolver that is associated with the <xref:System.Web.Script.Serialization.JavaScriptSerializer> object will use the type metadata marker value to map back to the appropriate managed type.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Type">
<MemberSignature Language="C#" Value="public Type Type { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type Type" />
<MemberSignature Language="DocId" Value="P:System.Web.Script.Services.GenerateScriptTypeAttribute.Type" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Type As Type" />
<MemberSignature Language="F#" Value="member this.Type : Type" Usage="System.Web.Script.Services.GenerateScriptTypeAttribute.Type" />
<MemberSignature Language="C++ CLI" Value="public:
 property Type ^ Type { Type ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the type that is included in the proxy object.</summary>
<value>The type object that is included in the generated proxy object.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>