private static object CreateObject(DbProviderFactory factory, ProviderSupportedClasses kindOfObject, string providerName)
        {
            switch (kindOfObject)
            {
            case ProviderSupportedClasses.DbConnection:
                return(factory.CreateConnection());

            case ProviderSupportedClasses.DbDataAdapter:
                return(factory.CreateDataAdapter());

            case ProviderSupportedClasses.DbParameter:
                return(factory.CreateParameter());

            case ProviderSupportedClasses.DbCommand:
                return(factory.CreateCommand());

            case ProviderSupportedClasses.DbCommandBuilder:
                return(factory.CreateCommandBuilder());

            case ProviderSupportedClasses.DbDataSourceEnumerator:
                return(factory.CreateDataSourceEnumerator());

            case ProviderSupportedClasses.CodeAccessPermission:
                return(factory.CreatePermission(PermissionState.None));
            }
            throw new InternalException(string.Format(CultureInfo.CurrentCulture, "Cannot create object of provider class identified by enum {0} for provider {1}", new object[] { Enum.GetName(typeof(ProviderSupportedClasses), kindOfObject), providerName }));
        }
Beispiel #2
0
 /// <summary>
 /// Returns a new instance of the provider's class that implements the provider's version of the <see cref="CodeAccessPermission"/> class.
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public override CodeAccessPermission CreatePermission(System.Security.Permissions.PermissionState state)
 {
     return(_dbProviderFactory.CreatePermission(state));
 }
Beispiel #3
0
 /// <summary>
 /// proxy
 /// </summary>
 public override System.Security.CodeAccessPermission CreatePermission(System.Security.Permissions.PermissionState state)
 {
     return(tail.CreatePermission(state));
 }
Beispiel #4
0
 /// <summary>
 /// Returns a new instance of the provider's class that implements the provider's version of the <see cref="CodeAccessPermission"/>
 /// </summary>
 /// <param name="state">An instance of <see cref="PermissionState"/></param>
 /// <returns>Returns an instance of <see cref="CodeAccessPermission"/></returns>
 public virtual CodeAccessPermission CreatePermission(PermissionState state)
 {
     return(_factory.CreatePermission(state));
 }
Beispiel #5
0
 /// <summary>Returns a new instance of the provider's class that implements the provider's version of the <see cref="CodeAccessPermission"/> class.</summary>
 /// <param name="state">One of the <see cref="PermissionState"/> values.</param>
 /// <returns>A <see cref="CodeAccessPermission"/> object for the specified <see cref="PermissionState"/>.</returns>
 public override CodeAccessPermission CreatePermission(PermissionState state) => _tail.CreatePermission(state);
Beispiel #6
0
 public override CodeAccessPermission CreatePermission(PermissionState state)
 {
     return(m_inner.CreatePermission(state));
 }
Beispiel #7
0
 /// <summary>Returns a new instance of the provider's class that implements the provider's version of the <see cref="CodeAccessPermission"/> class.</summary>
 /// <param name="state">One of the <see cref="PermissionState"/> values.</param>
 /// <returns>A <see cref="CodeAccessPermission"/> object for the specified <see cref="PermissionState"/>.</returns>
 public override CodeAccessPermission CreatePermission(PermissionState state) => _factory.CreatePermission(state);
Beispiel #8
0
 /// <summary>
 /// Returns a new instance of the provider's class that implements the provider's version of the <see cref="T:System.Security.CodeAccessPermission"></see> class.
 /// </summary>
 /// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState"></see> values.</param>
 /// <returns>
 /// A <see cref="T:System.Data.Common.CodeAccessPermission"></see> object for the specified <see cref="T:System.Security.Permissions.PermissionState"></see>.
 /// </returns>
 public override System.Security.CodeAccessPermission CreatePermission(System.Security.Permissions.PermissionState state)
 {
     return(m_underlyingFactory.CreatePermission(state));
 }
 /// <inheritdoc />
 public override CodeAccessPermission CreatePermission(PermissionState state)
 {
     return(_underlyingProvider.CreatePermission(state));
 }