Example #1
0
        internal System.Data.SqlClient.ApplicationIntent ConvertValueToApplicationIntent()
        {
            object value = base.Parsetable[KEY.ApplicationIntent];

            if (value == null)
            {
                return(DEFAULT.ApplicationIntent);
            }

            // when wrong value is used in the connection string provided to SqlConnection.ConnectionString or c-tor,
            // wrap Format and Overflow exceptions with Argument one, to be consistent with rest of the keyword types (like int and bool)
            try
            {
                return(DbConnectionStringBuilderUtil.ConvertToApplicationIntent(KEY.ApplicationIntent, value));
            }
            catch (FormatException e)
            {
                throw ADP.InvalidConnectionOptionValue(KEY.ApplicationIntent, e);
            }
            catch (OverflowException e)
            {
                throw ADP.InvalidConnectionOptionValue(KEY.ApplicationIntent, e);
            }
            // ArgumentException and other types are raised as is (no wrapping)
        }
        internal System.Data.SqlClient.ApplicationIntent ConvertValueToApplicationIntent()
        {
            System.Data.SqlClient.ApplicationIntent intent;
            object obj2 = base.Parsetable["applicationintent"];

            if (obj2 == null)
            {
                return(System.Data.SqlClient.ApplicationIntent.ReadWrite);
            }
            try
            {
                intent = DbConnectionStringBuilderUtil.ConvertToApplicationIntent("applicationintent", obj2);
            }
            catch (FormatException exception2)
            {
                throw ADP.InvalidConnectionOptionValue("applicationintent", exception2);
            }
            catch (OverflowException exception)
            {
                throw ADP.InvalidConnectionOptionValue("applicationintent", exception);
            }
            return(intent);
        }
 private static ApplicationIntent ConvertToApplicationIntent(string keyword, object value)
 {
     return(DbConnectionStringBuilderUtil.ConvertToApplicationIntent(keyword, value));
 }