src/Misc/EntityFramework.PowerShell/ConnectionFactoryConfig/ConfigFileManipulator.cs
// <summary>
// Checks whether or not the given XML document representing a .config file contains
// an EntityFramework "defaultConnectionFactory" entry or not. If no entry is found then one
// is added for the given connection factory specification.
// </summary>
// <param name="config"> An XML document representing the config file. </param>
// <param name="specification"> Specifies the connection factory and constructor arguments to use. </param>
// <returns> True if the document was modified; false if no change was made. </returns>
Checks whether or not the given XML document representing a .config file contains
an EntityFramework "defaultConnectionFactory" entry or not. If no entry is found then one
is added for the given connection factory specification.
Checks whether or not the given XML document representing a . config file contains an EntityFramework " defaultConnectionFactory " entry or not . If no entry is found then one is added for the given connection factory specification .
public virtual bool AddConnectionFactoryToConfig(XDocument config, ConnectionFactorySpecification specification)
        {
            DebugCheck.NotNull(config);
            DebugCheck.NotNull(specification);
            var entityFramework = config
                .GetOrCreateElement(ConfigurationElementName)
                .GetOrCreateElement(EntityFrameworkElementName);
            if (entityFramework.Elements(DefaultConnectionFactoryElementName).Any())
            {
                return false;
            }
            var factoryElement = entityFramework
                .GetOrCreateElement(
                    DefaultConnectionFactoryElementName,
                    new XAttribute("type", specification.ConnectionFactoryName));
            AddFactoryArguments(factoryElement, specification);
            return true;
        }
public virtual bool AddConnectionFactoryToConfig ( XDocument config , ConnectionFactorySpecification specification ) { DebugCheck . NotNull ( config ) ; DebugCheck . NotNull ( specification ) ; var entityFramework = config . GetOrCreateElement ( ConfigurationElementName ) . GetOrCreateElement ( EntityFrameworkElementName ) ; if ( entityFramework . Elements ( DefaultConnectionFactoryElementName ) . Any ( ) ) { return false ; } var factoryElement = entityFramework . GetOrCreateElement ( DefaultConnectionFactoryElementName , new XAttribute ( " " , specification . ConnectionFactoryName ) ) ; AddFactoryArguments ( factoryElement , specification ) ; return true ; }
Checks whether or not the given XML document representing a .config file contains
an EntityFramework "defaultConnectionFactory" entry or not.
Checks whether or not the given XML document representing a . config file contains an EntityFramework " defaultConnectionFactory " entry or not .
True if the document was modified; false if no change was made.
True if the document was modified ; false if no change was made .
config
XDocument
An XML document representing the config file.
An XML document representing the config file .
specification
ConnectionFactorySpecification
Specifies the connection factory and constructor arguments to use.
Specifies the connection factory and constructor arguments to use .