You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/best-practices/business-logic/develop-iplugin-implementations-stateless.md
@@ -32,83 +32,84 @@ Members of classes that implement the <xref href="Microsoft.Xrm.Sdk.IPlugin?text
32
32
33
33
## Guidance
34
34
35
-
When implementing <xref:Microsoft.Xrm.Sdk.IPlugin>, do not use member fields and properties and write the <xref:Microsoft.Xrm.Sdk.IPlugin.Execute*> method as a stateless operation. All per invocation state information should be accessed via the execution context only.
35
+
When implementing <xref:Microsoft.Xrm.Sdk.IPlugin>, don't use member fields and properties and write the <xref:Microsoft.Xrm.Sdk.IPlugin.Execute*> method as a stateless operation. All per invocation state information should be accessed via the execution context only.
36
36
37
-
Do not attempt to store any execution state data in member fields or properties for use during the current or next plug-in invocation unless that data was obtained from the configuration parameter provided to the overloaded constructor.
37
+
Don't attempt to store any execution state data in member fields or properties for use during the current or next plug-in invocation unless that data was obtained from the configuration parameter provided to the overloaded constructor.
38
38
39
-
Do not use code that registers to AppDomain events. Plugin logic should not rely on any AppDomain events or properties, since the internal implementation of the plugin infrastructure can change the execution behavior at any point of time. This can cause failures even if the code worked at some point in time.
39
+
Don't use code that registers to AppDomain events. Plugin logic shouldn't rely on any AppDomain events or properties, since the internal implementation of the plugin infrastructure can change the execution behavior at any point of time. Registering to AppDomain events can cause failures even if the code worked at some point in time.
40
40
41
41
Read-only, static, and constant members are inherently thread-safe and can also be used reliably within a plug-in class. The following are some examples on how to maintain thread-safe plug-ins:
42
42
43
-
- Constant field members
44
-
45
-
```csharp
46
-
publicclassValid_ClassConstantMember : IPlugin
47
-
{
48
-
publicconststringvalidConstantMember="Plugin registration not valid for {0} message.";
AfterMicrosoftDataverseinstantiatestheplug-inclass, theplatformcachesthatplug-ininstancefor performance reasons. The length of time that a plug-in instance is held in cache is managed by the platform. Certain operations, such as changing a plug-in's registration properties, will trigger a notification to the platform to refresh the cache. In these scenarios, the plug-in will be reinitialized.
189
+
After Microsoft Dataverse instantiates the plug-in class, the platform caches that plug-in instance for performance reasons. Dataverse manages the length of time that a plug-in instance is held in cache. Certain operations, such as changing a plug-in's registration properties, trigger a notification to the platform to refresh the cache. In these scenarios, the plug-in is reinitialized.
189
190
190
-
Because the platform caches plug-in class instances, the constructor is not called for every invocation of plug-in execution. For this reason, IPlugin implementations should not depend on the timing of operations in the constructor apart from obtaining static configuration data.
191
+
Because the platform caches plug-in class instances, the constructor isn't called for every invocation of plug-in execution. For this reason, IPlugin implementations shouldn't depend on the timing of operations in the constructor apart from obtaining static configuration data.
191
192
192
-
Another reason IPlugins should be stateless is that multiple system threads could execute the same, shared, plug-in instance concurrently. This opens up members of classes that implement IPlugin to potential thread-safety issues, which could lead to data inconsistency or performance problems.
193
+
Another reason IPlugins should be stateless is that multiple system threads could execute the same, shared, plug-in instance concurrently. This anti-pattern opens up members of classes that implement IPlugin to potential thread-safety issues, which could lead to data inconsistency or performance problems.
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/best-practices/business-logic/do-not-duplicate-plugin-step-registration.md
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: "Do not duplicate plug-in step registration | MicrosoftDocs"
3
-
description: "Duplicate plug-in step registration will cause the plug-in to fire multiple times on the same message/event."
description: "Duplicate plug-in step registration causes the plug-in to fire multiple times on the same message/event."
4
4
suite: powerapps
5
5
author: jowells
6
6
ms.topic: article
@@ -10,9 +10,7 @@ ms.author: jowells
10
10
search.audienceType:
11
11
- developer
12
12
---
13
-
# Do not duplicate plug-in step registration
14
-
15
-
13
+
# Don't duplicate plug-in step registration
16
14
17
15
**Category**: Performance
18
16
@@ -22,19 +20,20 @@ search.audienceType:
22
20
23
21
## Symptoms
24
22
25
-
Duplicate plug-in step registration will cause the plug-in to fire multiple times on the same message/event. This could lead to:
23
+
Duplicate plug-in step registration causes the plug-in to fire multiple times on the same message/event. Duplicate plug-in step registration could lead to:
26
24
27
25
- Delayed processing of asynchronous jobs when registered as an asynchronous execution mode.
28
26
- Degraded user performance experience when registered as a synchronous execution mode. Experiences include:
29
-
- Unresponsive model-driven apps
30
-
- Slow client interactions
31
-
- The browser stops responding
27
+
28
+
- Unresponsive model-driven apps
29
+
- Slow client interactions
30
+
- The browser stops responding
32
31
33
32
<aname='guidance'></a>
34
33
35
34
## Guidance
36
35
37
-
Ensure you are updating existing plug-in registration steps rather than deleting and re-creating them. Additionally, only create and update plug-in registration steps in a supported manner.
36
+
Ensure you're updating existing plug-in registration steps rather than deleting and re-creating them. Additionally, only create and update plug-in registration steps in a supported manner.
38
37
39
38
<aname='problem'></a>
40
39
@@ -43,17 +42,17 @@ Ensure you are updating existing plug-in registration steps rather than deleting
43
42
> [!WARNING]
44
43
> These patterns should be avoided.
45
44
46
-
Deleting and recreating a step in the source instance (test, dev, preprod) will also create a duplicate step being registered in the target environment if that step had been registered before.
45
+
Deleting and recreating a step in the source instance (test, dev, preprod) creates a duplicate step being registered in the target environment if that step was registered before.
Manually creating the `SDKMessageProcessingSteps` with a new GUID or updating the existing GUID within the `customizations.xml` file will result in a duplicate step being registered. These types of tasks are unsupported as outlined in [When to edit the customizations file](/power-platform/alm/when-edit-customization-file).
49
+
Manually creating the `SDKMessageProcessingSteps` with a new GUID or updating the existing GUID within the `customizations.xml` file results in a duplicate step being registered. These types of tasks are unsupported as outlined in [When to edit the customizations file](/power-platform/alm/when-edit-customization-file).
51
50
52
51
<aname='additional'></a>
53
52
54
53
## Additional information
55
54
56
-
Duplicate plug-in step registration could cause SQL deadlocking when the events are registered on an update message. When issuing an update on a record, SQL will create a row lock on that record. If another transaction tries to update that same record, it will have to wait until the lock is released before it's able to make the update. If a timeout occurs, the transaction is rolled back and the update is not committed to the SQL database.
55
+
Duplicate plug-in step registration could cause SQL deadlocking when the events are registered on an update message. When issuing an update on a record, SQL creates a row lock on that record. If another transaction tries to update that same record, it has to wait until the lock is released before it's able to make the update. If a timeout occurs, the transaction is rolled back and the update isn't committed to the SQL database.
0 commit comments