Skip to content

Commit eed8584

Browse files
authored
Set ms.topic to how-to (#23970)
1 parent 87d9065 commit eed8584

27 files changed

+731
-705
lines changed

docfx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
"docs/csharp/roslyn-sdk/tutorials/*.md" : "tutorial",
206206
"docs/csharp/tour-of-csharp/tutorials/**" : "tutorial",
207207
"docs/csharp/tutorials/**" : "tutorial",
208-
"docs/framework/**/*how-to*.md": "how-to",
208+
"docs/framework/**/how-to*.md": "how-to",
209209
"docs/framework/additional-apis/**/**.md": "managed-reference",
210210
"docs/framework/unmanaged-api/**/**.md": "reference",
211211
"docs/framework/wcf/diagnostics/etw/**.md": "reference",

docs/framework/app-domains/build-multifile-assembly.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "How to: Build a multifile assembly"
33
description: Learn how to build (create) a multifile assembly in .NET using sample code to illustrate each step in the procedure.
44
ms.date: "08/20/2019"
5+
ms.topic: how-to
56
helpviewer_keywords:
67
- "assemblies [.NET Framework], multifile"
78
- "entry point for assembly"

docs/framework/app-domains/build-single-file-assembly.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "How to: Build a .NET Framework single-file assembly"
33
description: Explore how to build a single-file assembly in .NET. A single-file assembly can be a library (.dll) that targets .NET, or it can be an executable (.exe) file.
44
ms.date: "08/20/2019"
5+
ms.topic: how-to
56
helpviewer_keywords:
67
- "assembly manifest, single-file assemblies"
78
- "library assemblies"

docs/framework/app-domains/install-assembly-into-gac.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "How to: Install an assembly into the global assembly cache"
33
description: Install an assembly into the global assembly cache (GAC) in .NET so it can be shared by many applications. Use Windows Installer or the GAC utility.
44
ms.date: 08/20/2019
5+
ms.topic: how-to
56
helpviewer_keywords:
67
- "assemblies [.NET Framework], global assembly cache"
78
- "Gacutil.exe"

docs/framework/data/adonet/implement-copytodatatable-where-type-not-a-datarow.md

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,26 @@
22
description: "Learn more about: How to: Implement CopyToDataTable<T> Where the Generic Type T Is Not a DataRow"
33
title: "How to: Implement CopyToDataTable<T> Where the Generic Type T Is Not a DataRow"
44
ms.date: "03/30/2017"
5-
dev_langs:
5+
ms.topic: how-to
6+
dev_langs:
67
- "csharp"
78
- "vb"
89
ms.assetid: b27b52cf-6172-485f-a75c-70ff9c5a2bd4
910
---
1011
# How to: Implement CopyToDataTable\<T> Where the Generic Type T Is Not a DataRow
1112

12-
The <xref:System.Data.DataTable> object is often used for data binding. The <xref:System.Data.DataTableExtensions.CopyToDataTable%2A> method takes the results of a query and copies the data into a <xref:System.Data.DataTable>, which can then be used for data binding. The <xref:System.Data.DataTableExtensions.CopyToDataTable%2A> methods, however, only operate on an <xref:System.Collections.Generic.IEnumerable%601> source where the generic parameter `T` is of type <xref:System.Data.DataRow>. Although this is useful, it does not allow tables to be created from a sequence of scalar types, from queries that project anonymous types, or from queries that perform table joins.
13-
14-
This topic describes how to implement two custom `CopyToDataTable<T>` extension methods that accept a generic parameter `T` of a type other than <xref:System.Data.DataRow>. The logic to create a <xref:System.Data.DataTable> from an <xref:System.Collections.Generic.IEnumerable%601> source is contained in the `ObjectShredder<T>` class, which is then wrapped in two overloaded `CopyToDataTable<T>` extension methods. The `Shred` method of the `ObjectShredder<T>` class returns the filled <xref:System.Data.DataTable> and accepts three input parameters: an <xref:System.Collections.Generic.IEnumerable%601> source, a <xref:System.Data.DataTable>, and a <xref:System.Data.LoadOption> enumeration. The initial schema of the returned <xref:System.Data.DataTable> is based on the schema of the type `T`. If an existing table is provided as input, the schema must be consistent with the schema of the type `T`. Each public property and field of the type `T` is converted to a <xref:System.Data.DataColumn> in the returned table. If the source sequence contains a type derived from `T`, the returned table schema is expanded for any additional public properties or fields.
15-
16-
For examples of using the custom `CopyToDataTable<T>` methods, see [Creating a DataTable From a Query](creating-a-datatable-from-a-query-linq-to-dataset.md).
17-
18-
### To implement the custom CopyToDataTable\<T> methods in your application
19-
20-
1. Implement the `ObjectShredder<T>` class to create a <xref:System.Data.DataTable> from an <xref:System.Collections.Generic.IEnumerable%601> source:
21-
13+
The <xref:System.Data.DataTable> object is often used for data binding. The <xref:System.Data.DataTableExtensions.CopyToDataTable%2A> method takes the results of a query and copies the data into a <xref:System.Data.DataTable>, which can then be used for data binding. The <xref:System.Data.DataTableExtensions.CopyToDataTable%2A> methods, however, only operate on an <xref:System.Collections.Generic.IEnumerable%601> source where the generic parameter `T` is of type <xref:System.Data.DataRow>. Although this is useful, it does not allow tables to be created from a sequence of scalar types, from queries that project anonymous types, or from queries that perform table joins.
14+
15+
This topic describes how to implement two custom `CopyToDataTable<T>` extension methods that accept a generic parameter `T` of a type other than <xref:System.Data.DataRow>. The logic to create a <xref:System.Data.DataTable> from an <xref:System.Collections.Generic.IEnumerable%601> source is contained in the `ObjectShredder<T>` class, which is then wrapped in two overloaded `CopyToDataTable<T>` extension methods. The `Shred` method of the `ObjectShredder<T>` class returns the filled <xref:System.Data.DataTable> and accepts three input parameters: an <xref:System.Collections.Generic.IEnumerable%601> source, a <xref:System.Data.DataTable>, and a <xref:System.Data.LoadOption> enumeration. The initial schema of the returned <xref:System.Data.DataTable> is based on the schema of the type `T`. If an existing table is provided as input, the schema must be consistent with the schema of the type `T`. Each public property and field of the type `T` is converted to a <xref:System.Data.DataColumn> in the returned table. If the source sequence contains a type derived from `T`, the returned table schema is expanded for any additional public properties or fields.
16+
17+
For examples of using the custom `CopyToDataTable<T>` methods, see [Creating a DataTable From a Query](creating-a-datatable-from-a-query-linq-to-dataset.md).
18+
19+
### To implement the custom CopyToDataTable\<T> methods in your application
20+
21+
1. Implement the `ObjectShredder<T>` class to create a <xref:System.Data.DataTable> from an <xref:System.Collections.Generic.IEnumerable%601> source:
22+
2223
[!code-csharp[DP Custom CopyToDataTable Examples#ObjectShredderClass](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/CS/Program.cs#objectshredderclass)]
23-
[!code-vb[DP Custom CopyToDataTable Examples#ObjectShredderClass](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/VB/Module1.vb#objectshredderclass)]
24+
[!code-vb[DP Custom CopyToDataTable Examples#ObjectShredderClass](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/VB/Module1.vb#objectshredderclass)]
2425

2526
The preceding example assumes that the properties and fields of the `DataColumn` are not nullable value types. To handle properties and fields with nullable value types, use the following code:
2627

@@ -32,47 +33,47 @@ The <xref:System.Data.DataTable> object is often used for data binding. The <xre
3233
DataColumn dc = table.Columns.Contains(f.Name) ? table.Columns[f.Name] : table.Columns.Add(f.Name, Nullable.GetUnderlyingType(f.FieldType) ?? f.FieldType);
3334
```
3435

35-
2. Implement the custom `CopyToDataTable<T>` extension methods in a class:
36-
36+
2. Implement the custom `CopyToDataTable<T>` extension methods in a class:
37+
3738
[!code-csharp[DP Custom CopyToDataTable Examples#CustomCopyToDataTableMethods](../../../../samples/snippets/csharp/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/CS/Program.cs#customcopytodatatablemethods)]
38-
[!code-vb[DP Custom CopyToDataTable Examples#CustomCopyToDataTableMethods](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/VB/Module1.vb#customcopytodatatablemethods)]
39-
40-
3. Add the `ObjectShredder<T>` class and `CopyToDataTable<T>` extension methods to your application.
41-
42-
```vb
43-
Module Module1
44-
Sub Main()
45-
' Your application code using CopyToDataTable<T>.
46-
End Sub
47-
End Module
48-
49-
Public Module CustomLINQtoDataSetMethods
50-
51-
End Module
52-
53-
Public Class ObjectShredder(Of T)
54-
39+
[!code-vb[DP Custom CopyToDataTable Examples#CustomCopyToDataTableMethods](../../../../samples/snippets/visualbasic/VS_Snippets_ADO.NET/DP Custom CopyToDataTable Examples/VB/Module1.vb#customcopytodatatablemethods)]
40+
41+
3. Add the `ObjectShredder<T>` class and `CopyToDataTable<T>` extension methods to your application.
42+
43+
```vb
44+
Module Module1
45+
Sub Main()
46+
' Your application code using CopyToDataTable<T>.
47+
End Sub
48+
End Module
49+
50+
Public Module CustomLINQtoDataSetMethods
51+
52+
End Module
53+
54+
Public Class ObjectShredder(Of T)
55+
5556
End Class
5657
```
57-
58+
5859
```csharp
59-
class Program
60-
{
61-
static void Main(string[] args)
62-
{
63-
// Your application code using CopyToDataTable<T>.
64-
}
65-
}
66-
public static class CustomLINQtoDataSetMethods
67-
{
68-
69-
}
70-
public class ObjectShredder<T>
71-
{
72-
73-
}
60+
class Program
61+
{
62+
static void Main(string[] args)
63+
{
64+
// Your application code using CopyToDataTable<T>.
65+
}
66+
}
67+
public static class CustomLINQtoDataSetMethods
68+
{
69+
70+
}
71+
public class ObjectShredder<T>
72+
{
73+
74+
}
7475
```
75-
76+
7677
## See also
7778

7879
- [Creating a DataTable From a Query](creating-a-datatable-from-a-query-linq-to-dataset.md)

docs/framework/data/wcf/attach-an-existing-entity-to-dc-wcf-data.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22
description: "Learn more about: How to: Attach an Existing Entity to the DataServiceContext (WCF Data Services)"
33
title: "How to: Attach an Existing Entity to the DataServiceContext (WCF Data Services)"
44
ms.date: "03/30/2017"
5-
dev_langs:
5+
ms.topic: how-to
6+
dev_langs:
67
- "csharp"
78
- "vb"
8-
helpviewer_keywords:
9+
helpviewer_keywords:
910
- "WCF Data Services, changing data"
1011
ms.assetid: e3f2d71d-434c-4e98-91c3-95adae4702b6
1112
---
1213
# How to: Attach an Existing Entity to the DataServiceContext (WCF Data Services)
1314

1415
[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)]
1516

16-
When an entity already exists in a data service, the WCF Data Services client library enables you to attach an object that represents the entity directly to the <xref:System.Data.Services.Client.DataServiceContext> without first executing a query. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md).
17-
18-
The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md).
19-
20-
## Example
17+
When an entity already exists in a data service, the WCF Data Services client library enables you to attach an object that represents the entity directly to the <xref:System.Data.Services.Client.DataServiceContext> without first executing a query. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md).
18+
19+
The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md).
20+
21+
## Example
22+
23+
The following example shows how to create an existing `Customer` object that contains changes to be saved to the data service. The object is attached to the context and the <xref:System.Data.Services.Client.DataServiceContext.UpdateObject%2A> method is called to mark the attached object as <xref:System.Data.Services.Client.EntityStates.Modified> before the <xref:System.Data.Services.Client.DataServiceContext.SaveChanges%2A> method is called.
2124

22-
The following example shows how to create an existing `Customer` object that contains changes to be saved to the data service. The object is attached to the context and the <xref:System.Data.Services.Client.DataServiceContext.UpdateObject%2A> method is called to mark the attached object as <xref:System.Data.Services.Client.EntityStates.Modified> before the <xref:System.Data.Services.Client.DataServiceContext.SaveChanges%2A> method is called.
23-
2425
[!code-csharp[Astoria Northwind Client#AttachObject](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#attachobject)]
25-
[!code-vb[Astoria Northwind Client#AttachObject](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#attachobject)]
26-
26+
[!code-vb[Astoria Northwind Client#AttachObject](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#attachobject)]
27+
2728
## See also
2829

2930
- [WCF Data Services Client Library](wcf-data-services-client-library.md)

docs/framework/data/wcf/bind-data-to-wpf-elements-wcf-data-services.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
description: "Learn more about: How to: Bind Data to Windows Presentation Foundation Elements (WCF Data Services)"
33
title: "How to: Bind Data to Windows Presentation Foundation Elements (WCF Data Services)"
44
ms.date: "03/30/2017"
5-
dev_langs:
5+
ms.topic: how-to
6+
dev_langs:
67
- "csharp"
78
- "vb"
8-
helpviewer_keywords:
9+
helpviewer_keywords:
910
- "data binding, WCF Data Services"
1011
- "WCF Data Services, data binding"
1112
ms.assetid: d6538ab0-0abe-426a-b9d9-e6f3a5ca2016
@@ -14,32 +15,32 @@ ms.assetid: d6538ab0-0abe-426a-b9d9-e6f3a5ca2016
1415

1516
[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)]
1617

17-
With WCF Data Services, you can bind Windows Presentation Foundation (WPF) elements such as a <xref:System.Windows.Controls.ListBox> or <xref:System.Windows.Controls.ComboBox> to an instance of <xref:System.Data.Services.Client.DataServiceCollection%601>, which handles the events raised by the controls to keep the <xref:System.Data.Services.Client.DataServiceContext> synchronized with changes made to data in the controls. For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md).
18-
19-
The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md).
20-
21-
## Example
18+
With WCF Data Services, you can bind Windows Presentation Foundation (WPF) elements such as a <xref:System.Windows.Controls.ListBox> or <xref:System.Windows.Controls.ComboBox> to an instance of <xref:System.Data.Services.Client.DataServiceCollection%601>, which handles the events raised by the controls to keep the <xref:System.Data.Services.Client.DataServiceContext> synchronized with changes made to data in the controls. For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md).
19+
20+
The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md).
21+
22+
## Example
23+
24+
The following example is from the code-behind page for an Extensible Application Markup Language (XAML) page that defines the `SalesOrders` window in WPF. When the window is loaded, a <xref:System.Data.Services.Client.DataServiceCollection%601> is created based on the result of a query that returns customers, filtered by country/region. All of the pages of this paged result are loaded, along with the related orders, and are bound to the <xref:System.Windows.FrameworkElement.DataContext%2A> property of the <xref:System.Windows.Controls.StackPanel> that is the root layout control for the WPF window. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md).
2225

23-
The following example is from the code-behind page for an Extensible Application Markup Language (XAML) page that defines the `SalesOrders` window in WPF. When the window is loaded, a <xref:System.Data.Services.Client.DataServiceCollection%601> is created based on the result of a query that returns customers, filtered by country/region. All of the pages of this paged result are loaded, along with the related orders, and are bound to the <xref:System.Windows.FrameworkElement.DataContext%2A> property of the <xref:System.Windows.Controls.StackPanel> that is the root layout control for the WPF window. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md).
24-
2526
[!code-csharp[Astoria Northwind Client#BindPagedData](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs#bindpageddata)]
26-
[!code-vb[Astoria Northwind Client#BindPagedData](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml.vb#bindpageddata)]
27-
28-
## Example
29-
30-
The following XAML defines the `SalesOrders` window in WPF for the previous example.
31-
32-
[!code-xaml[Astoria Northwind Client#BindPagedDataXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml#bindpageddataxaml)]
33-
34-
## Example
35-
36-
The following example is from the code-behind page for an Extensible Application Markup Language (XAML) page that defines the `SalesOrders` window in WPF. When the window is loaded, a <xref:System.Data.Services.Client.DataServiceCollection%601> is created based on the result of a query that returns customers with related objects, filtered by country/region. This result is bound to the <xref:System.Windows.FrameworkElement.DataContext%2A> property of the <xref:System.Windows.Controls.StackPanel> that is the root layout control for the WPF window.
37-
27+
[!code-vb[Astoria Northwind Client#BindPagedData](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml.vb#bindpageddata)]
28+
29+
## Example
30+
31+
The following XAML defines the `SalesOrders` window in WPF for the previous example.
32+
33+
[!code-xaml[Astoria Northwind Client#BindPagedDataXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml#bindpageddataxaml)]
34+
35+
## Example
36+
37+
The following example is from the code-behind page for an Extensible Application Markup Language (XAML) page that defines the `SalesOrders` window in WPF. When the window is loaded, a <xref:System.Data.Services.Client.DataServiceCollection%601> is created based on the result of a query that returns customers with related objects, filtered by country/region. This result is bound to the <xref:System.Windows.FrameworkElement.DataContext%2A> property of the <xref:System.Windows.Controls.StackPanel> that is the root layout control for the WPF window.
38+
3839
[!code-csharp[Astoria Northwind Client#WpfDataBinding](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs#wpfdatabinding)]
39-
[!code-vb[Astoria Northwind Client#WpfDataBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml.vb#wpfdatabinding)]
40-
41-
## Example
40+
[!code-vb[Astoria Northwind Client#WpfDataBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml.vb#wpfdatabinding)]
41+
42+
## Example
43+
44+
The following XAML defines the `SalesOrders` window in WPF for the previous example.
4245

43-
The following XAML defines the `SalesOrders` window in WPF for the previous example.
44-
4546
[!code-xaml[Astoria Northwind Client#WpfDataBindingXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml#wpfdatabindingxaml)]

docs/framework/data/wcf/create-a-data-service-using-an-adonet-ef-data-wcf.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
description: "Learn more about: How to: Create a Data Service Using an ADO.NET Entity Framework Data Source (WCF Data Services)"
33
title: "How to: Create a Data Service Using an ADO.NET Entity Framework Data Source (WCF Data Services)"
44
ms.date: 08/24/2018
5+
ms.topic: how-to
56
helpviewer_keywords:
67
- "WCF Data Services, providers"
78
- "WCF Data Services, Entity Framework"

0 commit comments

Comments
 (0)