BindToTypePolicy.QueryNonTrustedTypeValidationEventArgs.DoNotTrustThisType() Method
Specifies that the custom (“unknown”) type is “unsafe” and throws a security warning.
Namespace: DevExpress.Utils
Assembly: DevExpress.Data.v24.2.dll
Declaration
Remarks
The following example validates custom data types:
using System;
using System.Windows.Forms;
namespace DXApplication {
internal static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Utils.BindToTypePolicy.QueryNonTrustedTypeValidation += BindToTypePolicy_QueryNonTrustedTypeValidation;
Application.Run(new Form1());
}
private static void BindToTypePolicy_QueryNonTrustedTypeValidation(object sender, DevExpress.Utils.BindToTypePolicy.QueryNonTrustedTypeValidationEventArgs e) {
if (e.IsUnsafe)
throw new MyAppLicationSecurityException(e.AssemblyQualifiedTypeName);
if (e.AssemblyName == typeof(Program).Assembly.FullName)
e.TrustThisType();
if (e.TypeName == "ObsoleteJsonDataSource")
e.DoNotTrustThisType();
}
}
}
See Also