Code 4.7 Enterprise Services Enterprise Service
1. Do not catch exceptions in the transaction method. To use the AutoComplete property.
Don't catch exceptions in a transactional method. Use the AutoComplete attribute.
A) Chapter 4 in COM and. NET Component Services.
2. Do not call SetComplete (), SetAbort (), and related methods. To use the AutoComplete property.
Don't call SetComplete (), SetAbort (), and "like." Use the AutoComplete attribute.
[Transaction]
public class Mycomponent:servicedcomponent
{
[AutoComplete]
public void MyMethod (long objectidentifier)
{
GetState (Objectidentifier);
DoWork ();
SaveState (Objectidentifier);
}
}
3. Always overwrite the CanBePooled method and return True (unless you have a better reason not to return the value to the pool).
Always override CanBePooled and return True (unless your have a good reason not to return to pool).
public class Mycomponent:servicedcomponent
{
protected override bool CanBePooled ()
{
return true;
}
}
4. Always call Dispose () in the object pool, unless the component has been configured to use Jita.
Always call Dispose () explicitly on a pooled objects unless the component is configured to use Jita as.
5. You cannot call Dispose () when the build uses Jita.
Never call Dispose () the components uses Jita.
6. Always set the level of permissions for applications and components.
Always set authorization level to application and component.
7. Set the certificate level of all applications to private.
Set Authentication level to privacy in all applications.
[Assembly:applicationactivation (Activationoption.server)]
[Assembly:applicationaccesscontrol (
True,//authorization
Accesscheckslevel = Accesschecksleveloption.applicationcomponent,
authentication = Authenticationoption.privacy,
ImpersonationLevel = impersonationleveloption.identify)]
8. Set the role level of the client assembly to identity.
Set Impersonation level on the client assemblies to Identity.
9. Always set the ComponentAccessControl property of the serviced component to true.
Always set ComponentAccessControl attribute on serviced components to true.
A) The default is True
[ComponentAccessControl]
public class Mycomponent:servicedcomponent
{...}
10. Always set each user role to marshaler.
Always add to the marshaler is the Everyone user.
[Assembly:securerole ("marshaler", seteveryoneaccess = True)]
11. Apply the SecureMethod attribute to all classes that require a certificate of inspection.
Apply SecureMethod attribute to all classes requiring authentication.
[Securitymethod]
public class Mycomponent:servicedcomponent
{...}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.