// Internal for testing protected internal virtual string GetNamespace( [CanBeNull] Migration lastMigration, [NotNull] string rootNamespace, [NotNull] Type contextType) { Check.NotEmpty(rootNamespace, "rootNamespace"); Check.NotNull(contextType, "contextType"); if (lastMigration != null) { return(lastMigration.GetType().Namespace); } var @namespace = rootNamespace + ".Migrations"; var existingMigrations = from t in MigrationAssembly.GetMigrationTypes(MigrationAssembly.Assembly) where t.Namespace == @namespace && MigrationAssembly.TryGetContextType(t) != contextType select t; if (existingMigrations.Any()) { return(@namespace + "." + contextType.Name); } return(@namespace); }
public virtual IEnumerable <Type> GetContextTypes() => ContextTool.GetContextTypes(_assembly) .Concat( MigrationAssembly.GetMigrationTypes(_assembly) .Select(MigrationAssembly.TryGetContextType) .Where(t => t != null)) .Distinct();
private IEnumerable <Type> GetMigrationTypes() { return(MigrationAssembly.GetMigrationTypes(_assembly)); }