Skip to content

Commit 0a2acbf

Browse files
tompratt-AQmairaw
authored andcommitted
Review and fix TODO code snippet references (#2023)
* Review and fix TODO code snippet references (docs 2) * Fix build error * Add snippet files and address review comments * Make changes per review comments and delete duplicate .config files
1 parent 139d80d commit 0a2acbf

File tree

82 files changed

+566
-1162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+566
-1162
lines changed

docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ With [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)], you can create
2424

2525
The behaviors of the data service are defined by the members of the <xref:System.Data.Services.DataServiceConfiguration> class, and by members of the <xref:System.Data.Services.DataServiceBehavior> class, which is accessed from the <xref:System.Data.Services.DataServiceConfiguration.DataServiceBehavior%2A> property of the <xref:System.Data.Services.DataServiceConfiguration> class. The <xref:System.Data.Services.DataServiceConfiguration> class is supplied to the `InitializeService` method that is implemented by the data service, as in the following implementation of a Northwind data service:
2626

27-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindService#DataServiceConfigComplete](Astoria NorthwindService#DataServiceConfigComplete)] -->
27+
[!code-csharp[Astoria Northwind Service#DataServiceConfigComplete](../../../../samples/snippets/csharp/VS_Snippets_Misc/Astoria Northwind Service/cs/northwind.svc.cs#dataserviceconfigcomplete)]
28+
[!code-vb[Astoria Northwind Service#DataServiceConfigComplete](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/Astoria Northwind Service/vb/northwind.svc.vb#dataserviceconfigcomplete)]
2829

2930
## Data Service Configuration Settings
3031
The <xref:System.Data.Services.DataServiceConfiguration> class enables you to specify the following data service behaviors:

docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ When you use the [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] cli
2828
> [!NOTE]
2929
> When a data service requires you to manually set the message header for every request, consider registering the handler for the <xref:System.Data.Services.Client.DataServiceContext.SendingRequest> event by overriding the `OnContextCreated` partial method in the entity container that represents the data service, which in this case is `NorthwindEntities`.
3030
31-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#RegisterHeadersQuery](Astoria NorthwindClient#RegisterHeadersQuery)] -->
31+
[!code-csharp[Astoria Northwind Client#RegisterHeadersQuery](../../../../samples/snippets/csharp/VS_Snippets_Misc/Astoria Northwind Client/cs/source.cs#registerheadersquery)]
32+
[!code-vb[Astoria Northwind Client#RegisterHeadersQuery](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/Astoria Northwind Client/vb/source.vb#registerheadersquery)]
3233

3334
## Example
3435
The following method handles the <xref:System.Data.Services.Client.DataServiceContext.SendingRequest> event and adds an Authentication header to the request.
3536

36-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#OnSendingRequest](Astoria NorthwindClient#OnSendingRequest)] -->
37+
[!code-csharp[Astoria Northwind Client#OnSendingRequest](../../../../samples/snippets/csharp/VS_Snippets_Misc/Astoria Northwind Client/cs/source.cs#onsendingrequest)]
38+
[!code-vb[Astoria Northwind Client#OnSendingRequest](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/Astoria Northwind Client/vb/source.vb#onsendingrequest)]
3739

3840
## See Also
3941
[Securing WCF Data Services](../../../../docs/framework/data/wcf/securing-wcf-data-services.md)

docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client library e
4141

4242
The following query, when it is executed, returns all `Customers` entities in the Northwind data service:
4343

44-
[!code-csharp[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#getallcustomersspecific)]
44+
[!code-csharp[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#getallcustomersspecific)]
4545
[!code-vb[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#getallcustomersspecific)]
4646

4747
For more information, see [How to: Execute Data Service Queries](../../../../docs/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services.md).
@@ -51,7 +51,8 @@ The [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client library e
5151
## LINQ Queries
5252
Because the <xref:System.Data.Services.Client.DataServiceQuery%601> class implements the <xref:System.Linq.IQueryable%601> interface defined by LINQ, the [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client library is able to transform LINQ queries against entity set data into a URI that represents a query expression evaluated against a data service resource. The following example is a LINQ query that is equivalent to the previous <xref:System.Data.Services.Client.DataServiceQuery%601> that returns `Orders` that have a freight cost of more than $30 and orders the results by the freight cost:
5353

54-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#AddQueryOptionsLinqSpecific](Astoria NorthwindClient#AddQueryOptionsLinqSpecific)] -->
54+
[!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#addqueryoptionslinqspecific)]
55+
[!code-vb[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#addqueryoptionslinqspecific)]
5556

5657
This LINQ query is translated into the following query URI that is executed against the Northwind-based [quickstart](../../../../docs/framework/data/wcf/quickstart-wcf-data-services.md) data service:
5758

@@ -67,7 +68,8 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight
6768
## Adding Query Options
6869
Data service queries support all the query options that [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)]s provides. You call the <xref:System.Data.Services.Client.DataServiceQuery%601.AddQueryOption%2A> method to append query options to a <xref:System.Data.Services.Client.DataServiceQuery%601> instance. <xref:System.Data.Services.Client.DataServiceQuery%601.AddQueryOption%2A> returns a new <xref:System.Data.Services.Client.DataServiceQuery%601> instance that is equivalent to the original query but with the new query option set. The following query, when executed, returns `Orders` that are filtered by the `Freight` value and ordered by the `OrderID`, descending:
6970

70-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#AddQueryOptionsSpecific](Astoria NorthwindClient#AddQueryOptionsSpecific)] -->
71+
[!code-csharp[Astoria Northwind Client#AddQueryOptionsSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#addqueryoptionsspecific)]
72+
[!code-vb[Astoria Northwind Client#AddQueryOptionsSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#addqueryoptionsspecific)]
7173

7274
You can use the `$orderby` query option to both order and filter a query based on a single property, as in the following example that filters and orders the returned `Orders` objects based on the value of the `Freight` property:
7375

@@ -85,7 +87,8 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight
8587
## Client versus Server Execution
8688
The client executes a query in two parts. Whenever possible, expressions in a query are first evaluated on the client, and then a URI-based query is generated and sent to the data service for evaluation against data in the service. Consider the following LINQ query:
8789

88-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#LinqQueryClientEvalSpecific](Astoria NorthwindClient#LinqQueryClientEvalSpecific)] -->
90+
[!code-csharp[Astoria Northwind Client#LinqQueryClientEvalSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqqueryclientevalspecific)]
91+
[!code-vb[Astoria Northwind Client#LinqQueryClientEvalSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqqueryclientevalspecific)]
8992

9093
In this example, the expression `(basePrice – (basePrice * discount))` is evaluated on the client. Because of this, the actual query URI `http://localhost:12345/northwind.svc/Products()?$filter=(UnitPrice gt 90.00M) and substringof('bike',ProductName)` that is sent to the data service contains the already calculated decimal value of `90` in the filter clause. The other parts of the filtering expression, including the substring expression, are evaluated by the data service. Expressions that are evaluated on the client follow common language runtime (CLR) semantics, while expressions sent to the data service rely on the data service implementation of the [!INCLUDE[ssODataShort](../../../../includes/ssodatashort-md.md)] Protocol. You should also be aware of scenarios where this separate evaluation may cause unexpected results, such as when both the client and service perform time-based evaluations in different time zones.
9194

docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,24 @@ By default, the client library does not supply credentials when sending a reques
2525
## Example
2626
The following example is from the code-behind page for an Extensible Application Markup Language (XAML) file that is the main page of the Windows Presentation Framework application. This example displays a `LoginWindow` instance to collect authentication credentials from the user, and then uses these credentials when making a request to the data service.
2727

28-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#ClientCredentials](Astoria NorthwindClient#ClientCredentials)] -->
28+
[!code-csharp[Astoria Northwind Client#ClientCredentials](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml.cs#clientcredentials)]
29+
[!code-vb[Astoria Northwind Client#ClientCredentials](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/clientcredentials.xaml.vb#clientcredentials)]
2930

3031
## Example
3132
The following XAML defines the main page of the WPF application.
3233

33-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#ClientCredentialsXaml](Astoria NorthwindClient#ClientCredentialsXaml)] -->
34+
[!code-xml[Astoria Northwind Client#ClientCredentialsXaml](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml#clientcredentialsxaml)]
3435

3536
## Example
3637
The following example is from the code-behind page for the window that is used to collect the authentication credentials from the user before making a request to the data service.
3738

38-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#ClientCredentialsLogin](Astoria NorthwindClient#ClientCredentialsLogin)] -->
39+
[!code-csharp[Astoria Northwind Client#ClientCredentialsLogin](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml.cs#clientcredentialslogin)]
40+
[!code-vb[Astoria Northwind Client#ClientCredentialsLogin](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/clientcredentialslogin.xaml.vb#clientcredentialslogin)]
3941

4042
## Example
4143
The following XAML defines the login of the WPF application.
4244

43-
<!-- TODO: review snippet reference [!CODE [Astoria NorthwindClient#ClientCredentialsLoginXaml](Astoria NorthwindClient#ClientCredentialsLoginXaml)] -->
45+
[!code-xml[Astoria Northwind Client#ClientCredentialsLoginXaml](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml#clientcredentialsloginxaml)]
4446

4547
## .NET Framework Security
4648
The following security considerations apply to the example in this topic:

docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ To configure a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] service endp
4141

4242
### Code
4343
[!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)]
44-
[!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)]
45-
[!code-xml[C_HowTo-WCFServiceAndASMXClient#1](../../../samples/snippets/common/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)]
44+
[!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)]
45+
[!code-xml[C_HowTo-WCFServiceAndASMXClient#1](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)]
4646

4747
## See Also
4848
[Interoperability with ASP.NET Web Services](../../../docs/framework/wcf/feature-details/interop-with-aspnet-web-services.md)

docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Policy assertions describe the capabilities and requirements of a service endpoi
4949

5050
1. Add the importer type to the `<extensions>` element inside the [\<policyImporters>](../../../../docs/framework/configure-apps/file-schema/wcf/policyimporters.md) element in the client configuration file.
5151

52-
<!-- TODO: review snippet reference [!code[CustomPolicySample#7(../../../../samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/client.exe.config#7)] -->
52+
[!code-xml[CustomPolicySample#7](../../../../samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/client.exe.config#7)]
5353

5454
2. In the client application, use the <xref:System.ServiceModel.Description.MetadataResolver?displayProperty=fullName> or <xref:System.ServiceModel.Description.WsdlImporter?displayProperty=fullName> to resolve the metadata and the importer is invoked automatically.
5555

docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can inspect or modify the incoming or outgoing messages across a [!INCLUDE[i
4141
[!code-csharp[Interceptors#8](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs#8)]
4242
[!code-vb[Interceptors#8](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/interceptors/vb/insertingbehaviors.vb#8)]
4343

44-
<!-- TODO: review snippet reference [!code[Interceptors#9](../../../../samples/snippets/common/VS_Snippets_CFX/interceptors/common/hostapplication.exe.config#9)] -->
44+
[!code-xml[Interceptors#9](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/hostapplication.exe.config#9)]
4545

4646
## See Also
4747
<xref:System.ServiceModel.Dispatcher.IClientMessageInspector?displayProperty=fullName>

docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can inspect or modify the incoming or outgoing messages for a single operati
4141
[!code-csharp[Interceptors#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs#5)]
4242
[!code-vb[Interceptors#5](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/interceptors/vb/insertingbehaviors.vb#5)]
4343

44-
<!-- TODO: review snippet reference [!code[Interceptors#3](../../../../samples/snippets/common/VS_Snippets_CFX/interceptors/common/client.exe.config#3)] -->
44+
[!code-xml[Interceptors#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/client.exe.config#3)]
4545

4646
## See Also
4747
[Configuring and Extending the Runtime with Behaviors](../../../../docs/framework/wcf/extending/configuring-and-extending-the-runtime-with-behaviors.md)

docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To configure a [!INCLUDE[indigo1](../../../../includes/indigo1-md.md)] service e
4747

4848
[!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)]
4949
[!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)]
50-
<!-- TODO: review snippet reference [!code[C_HowTo-WCFServiceAndASMXClient#1](../../../../samples/snippets/common/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)] -->
50+
[!code-xml[C_HowTo-WCFServiceAndASMXClient#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)]
5151

5252
## See Also
5353
[How to: Create a Service Endpoint in Code](../../../../docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md)

0 commit comments

Comments
 (0)