Пример #1
0
        /// <summary>
        ///     Call this method to add a <see cref="IDbDependencyResolver" /> instance to the Chain of
        ///     Responsibility of resolvers that are used to resolve dependencies needed by the Entity Framework.
        /// </summary>
        /// <remarks>
        ///     Resolvers are asked to resolve dependencies in reverse order from which they are added. This means
        ///     that a resolver can be added to override resolution of a dependency that would already have been
        ///     resolved in a different way.
        ///     The only exception to this is that any dependency registered in the application's config file
        ///     will always be used in preference to using a dependency resolver added here, unless the
        ///     overrideConfigFile is set to true in which case the resolver added here will also override config
        ///     file settings.
        /// </remarks>
        /// <param name="resolver"> The resolver to add. </param>
        /// <param name="overrideConfigFile">If true, then the resolver added will take precedence over settings in the config file.</param>
        public void AddDependencyResolver(IDbDependencyResolver resolver, bool overrideConfigFile)
        {
            Check.NotNull(resolver, "resolver");

            _internalConfiguration.CheckNotLocked("AddDependencyResolver");
            _internalConfiguration.AddDependencyResolver(resolver, overrideConfigFile);
        }
 private static void AssertIsNotLocked(InternalConfiguration internalConfiguration)
 {
     Assert.DoesNotThrow(() => internalConfiguration.CheckNotLocked("Foo"));
 }
 private static void AssertIsLocked(InternalConfiguration internalConfiguration)
 {
     Assert.Throws <InvalidOperationException>(() => internalConfiguration.CheckNotLocked("Foo"));
 }
 private static void AssertIsNotLocked(InternalConfiguration internalConfiguration)
 {
     internalConfiguration.CheckNotLocked("Foo");
 }