示例#1
0
            protected override void RunCore()
            {
                var contextType = new TypeFinder(LoadContextAssembly()).FindType(
                    typeof(DbContext),
                    ContextTypeName,
                    types => types.Where(t => !typeof(HistoryContext).IsAssignableFrom(t) && !t.IsAbstract && !t.IsGenericType),
                    Error.EnableMigrations_NoContext,
                    (assembly, types) =>
                        {
                            var message = new StringBuilder();
                            message.Append(Strings.EnableMigrations_MultipleContexts(assembly));

                            foreach (var type in types)
                            {
                                message.AppendLine();
                                message.Append(Strings.EnableMigrationsForContext(type.FullName));
                            }

                            return new MigrationsException(message.ToString());
                        },
                    Error.EnableMigrations_NoContextWithName,
                    Error.EnableMigrations_MultipleContextsWithName);

                AppDomain.CurrentDomain.SetData("result", contextType.FullName);
            }
        public MigrationsConfigurationFinder(TypeFinder typeFinder)
        {
            DebugCheck.NotNull(typeFinder);

            _typeFinder = typeFinder;
        }