src/Shared/EntityFramework/Internal/LazyInternalConnection.cs
// <summary>
// Attempts to locate a connection entry in the configuration based on the supplied context name.
// </summary>
// <param name="name"> The name to search for. </param>
// <param name="config"> The configuration to search in. </param>
// <returns> Connection string if found, otherwise null. </returns>
Attempts to locate a connection entry in the configuration based on the supplied context name.
Attempts to locate a connection entry in the configuration based on the supplied context name .
private static ConnectionStringSettings FindConnectionInConfig(string name, AppConfig config)
        {
            var candidates = new List<string>
            {
                name
            };
            var lastDot = name.LastIndexOf('.');
            if (lastDot >= 0
                && lastDot + 1 < name.Length)
            {
                candidates.Add(name.Substring(lastDot + 1));
            }
            var appConfigConnection = (from c in candidates
                where config.GetConnectionString(c) != null
                select config.GetConnectionString(c)).FirstOrDefault();
            return appConfigConnection;
        }
private static ConnectionStringSettings FindConnectionInConfig ( string name , AppConfig config ) { var candidates = new List < string > { name } ; var lastDot = name . LastIndexOf ( ' ' ) ; if ( lastDot >= 0 && lastDot + 1 < name . Length ) { candidates . Add ( name . Substring ( lastDot + 1 ) ) ; } var appConfigConnection = ( from c in candidates where config . GetConnectionString ( c ) != null select config . GetConnectionString ( c ) ) . FirstOrDefault ( ) ; return appConfigConnection ; }
Attempts to locate a connection entry in the configuration based on the supplied context name.
Attempts to locate a connection entry in the configuration based on the supplied context name .
// Build a list of candidate names that might be found in the app.config/web.config file. // The first entry is the full name. // Second entry is full name with namespace stripped out. // Now go through each candidate.  As soon as we find one that matches, stop.
Connection string if found, otherwise null.
Connection string if found otherwise null .
name
string
The name to search for.
The name to search for .
config
AppConfig
The configuration to search in.
The configuration to search in .