Sets the security corresponding to the specified type for the specified object.
Namespace: Novalys.VisualGuard.SecurityAssembly: Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2016.0.105.16 (2016.0.105.16)
Syntax
C# |
---|
public void SetSecurity( Object target, Type type ) |
Visual Basic |
---|
Public Sub SetSecurity ( target As Object, type As Type ) |
Parameters
- target
- Type: System..::..Object
The object for which you want to set the security
- type
- Type: System..::..Type
a Type object specifying the type for which the actions are targeted. This type must be assignable from the type of the specified object.
Remarks
You need to call this method only once for each object instance.In most of case, this method must be called at the end of constructor of the object (after the call of InitializeComponent method for components).
This method registers the object in Visual Guard then it executes the actions defined for this target to be executed when the security is loaded.If some actions must be executed on other events, It handles these events. The actions associated to these events will be executed each time the events are raised.You can use this method when you define actions for an ancestor class. By default Visual Guard sets the security only for the type of the object and not for its ancestor.
For more information, you can consult:
For more information, you can consult:
How Visual Guard secures an application
How to apply security in your application
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | target or type is null. |
System..::..ArgumentException | the type of target is not a sub class of type. |