private static ISqlAdapter GetSqlAdapter(IDbConnection connection)
        {
            var name = GetDatabaseType?.Invoke(connection).ToLower()
                       ?? connection.GetType().Name.ToLower();

            return(AdapterDictionary.TryGetValue(name, out var adapter)
                ? adapter
                : DefaultAdapter);
        }
        private static ISqlAdapter GetFormatter(IDbConnection connection)
        {
            var name = GetDatabaseType?.Invoke(connection).ToLower()
                       ?? connection.GetType().Name.ToLower();

            return(!AdapterDictionary.ContainsKey(name)
                ? DefaultAdapter
                : AdapterDictionary[name]);
        }
        public static ISqlAdapter GetAdapter(IDbConnectionFactory connectionFactory)
        {
            var name = GetDatabaseType?.Invoke(connectionFactory)
                       ?? connectionFactory.GetType().Name;

            return(AdapterDictionary.TryGetValue(name, out var adapter)
                ? adapter
                : DefaultAdapter);
        }
Beispiel #4
0
 private static string GetSqlAdapterName <TConnection>() where TConnection : IDbConnection, new()
 => CleanSqlAdapterName(GetDatabaseType?.Invoke(new TConnection()) ?? typeof(TConnection).Name);