Пример #1
0
 private static void ParseNamedParameters(ConnectionStringItem item, ConnectionParameters result)
 {
     if (int.TryParse(item.PropertyValue?.Trim(), out var intValue))
     {
         result.NamedParameters = intValue != 0;
     }
     else if (bool.TryParse(item.PropertyValue?.Trim(), out var boolValue))
     {
         result.NamedParameters = boolValue;
     }
 }
Пример #2
0
 private static void ParseEnableServerPacketSize(ConnectionStringItem item, ConnectionParameters result)
 {
     if (int.TryParse(item.PropertyValue?.Trim(), out var intValue))
     {
         result.EnableServerPacketSize = intValue != 0;
     }
     else if (bool.TryParse(item.PropertyValue?.Trim(), out var boolValue))
     {
         result.EnableServerPacketSize = boolValue;
     }
 }
Пример #3
0
        private static void ParseServer(ConnectionStringItem item, ConnectionParameters result)
        {
            if (string.IsNullOrWhiteSpace(item.PropertyValue))
            {
                return;
            }
            var parts = item.PropertyValue.Split(',', ':');

            result.Server = parts[0];

            if (parts.Length > 1)
            {
                result.Port = Convert.ToInt32(parts[1]);
            }
        }
Пример #4
0
 private static void ParseEncryptPassword(ConnectionStringItem item, ConnectionParameters result)
 {
     if (bool.TryParse(item.PropertyValue, out var parsedBool))
     {
         result.EncryptPassword = parsedBool;
     }
     else if (int.TryParse(item.PropertyValue, out var parsedInt))
     {
         result.EncryptPassword = parsedInt != 0;
     }
     else
     {
         result.EncryptPassword = Convert.ToBoolean(item.PropertyValue);
     }
 }
Пример #5
0
 private static void ParseUseAseDecimal(ConnectionStringItem item, ConnectionParameters result)
 {
     if (bool.TryParse(item.PropertyValue, out var parsedBool))
     {
         result.UseAseDecimal = parsedBool;
     }
     else if (int.TryParse(item.PropertyValue, out var parsedInt))
     {
         result.UseAseDecimal = parsedInt != 0;
     }
     else
     {
         result.UseAseDecimal = Convert.ToBoolean(item.PropertyValue);
     }
 }
Пример #6
0
 private static void ParseLoginTimeout(ConnectionStringItem item, ConnectionParameters result)
 {
     result.LoginTimeout = Convert.ToInt32(item.PropertyValue);
 }
Пример #7
0
 private static void ParsePingServer(ConnectionStringItem item, ConnectionParameters result)
 {
     result.PingServer = Convert.ToBoolean(item.PropertyValue);
 }
Пример #8
0
 private static void ParseClientHostProc(ConnectionStringItem item, ConnectionParameters result)
 {
     result.ClientHostProc = item.PropertyValue;
 }
Пример #9
0
 private static void ParseApplicationName(ConnectionStringItem item, ConnectionParameters result)
 {
     result.ApplicationName = item.PropertyValue;
 }
Пример #10
0
 private static void ParseMinPoolSize(ConnectionStringItem item, ConnectionParameters result)
 {
     result.MinPoolSize = Convert.ToInt16(item.PropertyValue);
 }
Пример #11
0
 private static void ParseTrustedFile(ConnectionStringItem item, ConnectionParameters result)
 {
     result.TrustedFile = item.PropertyValue;
 }
Пример #12
0
 private static void ParseTextSize(ConnectionStringItem item, ConnectionParameters result)
 {
     result.TextSize = Convert.ToInt32(item.PropertyValue);
 }
Пример #13
0
 private static void ParseUsername(ConnectionStringItem item, ConnectionParameters result)
 {
     result.Username = item.PropertyValue;
 }
Пример #14
0
 private static void ParseDatabase(ConnectionStringItem item, ConnectionParameters result)
 {
     result.Database = item.PropertyValue;
 }
Пример #15
0
 private static void ParseAnsiNull(ConnectionStringItem item, ConnectionParameters result)
 {
     result.AnsiNull = Convert.ToInt32(item.PropertyValue) == 1;
 }
Пример #16
0
 private static void ParseConnectionLifetime(ConnectionStringItem item, ConnectionParameters result)
 {
     result.ConnectionLifetime = Convert.ToInt16(item.PropertyValue);
 }
Пример #17
0
 private static void ParsePacketSize(ConnectionStringItem item, ConnectionParameters result)
 {
     result.PacketSize = Convert.ToUInt16(item.PropertyValue);
 }
Пример #18
0
 private static void ParsePassword(ConnectionStringItem item, ConnectionParameters result)
 {
     result.Password = item.PropertyValue;
 }
Пример #19
0
 private static void ParseCharset(ConnectionStringItem item, ConnectionParameters result)
 {
     result.Charset = item.PropertyValue;
 }
Пример #20
0
 private static void ParseEncryption(ConnectionStringItem item, ConnectionParameters result)
 {
     result.Encryption = string.Equals(item.PropertyValue?.Trim(), "ssl", StringComparison.OrdinalIgnoreCase);
 }