Some properties may allow you to specify a .NET component, property, or field in your application. For example, the WebScheduleSqlClientProvider™ component allows you to specify the ConnectionID of an SqlConnection component at design time. At run time, such properties use late-binding (reflection) to connect with the named component, property, or field. Medium trust permits only late-binding to public members.
If the access qualifier on a .NET component, property, or field ("members") that you specify for these kinds of properties is the "protected", "private", "internal", or "family" keyword, then late-binding fails to connect. When running under partial trust, you must mark these members public or assign the property value directly.
For example, you have the choice of connecting the WebScheduleSqlClientProvider component to the SqlConnection in either of the following ways.
-
At design time, set the ConnectionID property to the name of your SqlConnection component (e.g., sqlConnection1) when sqlConnection1 has been marked with the "public" access qualifier.
-
At run time, during your Web Form’s Init event (after the InitializeComponents method has initialized your SqlConnection component), you can assign the SqlConnection component directly to the WebScheduleSqlClientProvider component’s Connection property.
Me.WebScheduleSqlClientProvider1.Connection = Me.sqlConnection1
this.WebScheduleSqlClientProvider1.Connection = this.sqlConnection1;