Ejemplo n.º 1
0
        private static bool IsInCurrentMigrationProfile(MigrationWithAttribute migrationWithAttribute, MigrationOptions options)
        {
            if (migrationWithAttribute.Attribute == null)
            {
                throw new InvalidOperationException("Subclasses of Migration that can be instantiated must have the MigrationAttribute." +
                                                    "If this class was intended as a base class for other migrations, make it an abstract class.");
            }

            //If no particular profiles have been set, then the migration is
            //effectively a part of all profiles
            var profiles = migrationWithAttribute.Attribute.Profiles;
            if (profiles.Any() == false)
                return true;

            //The migration must belong to at least one of the currently 
            //specified profiles
            return options.Profiles
                .Intersect(migrationWithAttribute.Attribute.Profiles, StringComparer.OrdinalIgnoreCase)
                .Any();
        }
Ejemplo n.º 2
0
        private static bool IsInCurrentMigrationProfile(MigrationWithAttribute migrationWithAttribute, MigrationOptions options)
        {
            if (migrationWithAttribute.Attribute == null)
            {
                throw new InvalidOperationException("Subclasses of Migration that can be instantiated must have the MigrationAttribute." +
                                                    "If this class was intended as a base class for other migrations, make it an abstract class.");
            }

            //If no particular profiles have been set, then the migration is
            //effectively a part of all profiles
            var profiles = migrationWithAttribute.Attribute.Profiles;

            if (profiles.Any() == false)
            {
                return(true);
            }

            //The migration must belong to at least one of the currently
            //specified profiles
            return(options.Profiles
                   .Intersect(migrationWithAttribute.Attribute.Profiles, StringComparer.OrdinalIgnoreCase)
                   .Any());
        }
Ejemplo n.º 3
0
 private static bool IsInCurrentMigrationProfile(MigrationWithAttribute migrationWithAttribute, MigrationOptions options)
 {
     return(string.IsNullOrWhiteSpace(migrationWithAttribute.Attribute.Profile) ||
            options.Profiles.Any(x => StringComparer.InvariantCultureIgnoreCase.Compare(migrationWithAttribute.Attribute.Profile, x) == 0));
 }