Skip to content

Commit 813aab1

Browse files
authored
Merge pull request #8892 from MicrosoftDocs/phecke-patch-1
Improved sample code snippet
2 parents be5a4c3 + 2f6a5ca commit 813aab1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

powerapps-docs/developer/data-platform/org-service/organizationservicecontext.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Use OrganizationServiceContext (Microsoft Dataverse) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "The OrganizationServiceContext class lets you track changes, manage identities and relationships, and gives you access to the LINQ provider." # 115-145 characters including spaces. This abstract displays in the search result.
4-
ms.date: 04/03/2022
4+
ms.date: 11/10/2023
55
author: kkanakas
66
ms.author: kartikka
77
ms.reviewer: pehecke
@@ -30,9 +30,12 @@ To instantiate the context class, you must pass the class constructor an object
3030
The following code example shows how to create a new instance of the context class. In this example, the context class was named `AdventureWorksCycleServiceContext` by specifying that name using the `--serviceContextName` parameter when running the `pac modelbuilder build` command:
3131

3232
```csharp
33-
//For early bound types to work correctly, they have to be enabled on the proxy.
34-
_serviceProxy.EnableProxyTypes();
35-
AdventureWorksCycleServiceContext context = new AdventureWorksCycleServiceContext(_service);
33+
// For early bound types to work correctly, they have to be enabled on the
34+
// client connection. Here, _service is a reference to a ServiceClient or
35+
// CrmServiceClient object. Those types implement IOrganizationService.
36+
_service.EnableProxyTypes();
37+
AdventureWorksCycleServiceContext context = new
38+
AdventureWorksCycleServiceContext(_service);
3639
```
3740

3841
After you create the context instance, you can begin to track creating, modifying, or deleting table rows (entity records).

0 commit comments

Comments
 (0)