public virtual Migration FindMigration(string nameOrId) { Check.NotEmpty(nameOrId, nameof(nameOrId)); var candidates = _idGenerator.IsValidId(nameOrId) ? Migrations.Where(m => m.Id == nameOrId) .Concat(Migrations.Where(m => string.Equals(m.Id, nameOrId, StringComparison.OrdinalIgnoreCase))) : Migrations.Where(m => _idGenerator.GetName(m.Id) == nameOrId) .Concat( Migrations.Where( m => string.Equals(_idGenerator.GetName(m.Id), nameOrId, StringComparison.OrdinalIgnoreCase))); return(candidates.FirstOrDefault()); }
public virtual string FindMigrationId(string nameOrId) => Migrations.Keys .Where( _idGenerator.IsValidId(nameOrId) ? (Func <string, bool>)(id => string.Equals(id, nameOrId, StringComparison.OrdinalIgnoreCase)) : id => string.Equals(_idGenerator.GetName(id), nameOrId, StringComparison.OrdinalIgnoreCase)) .FirstOrDefault();
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual string FindMigrationId(string nameOrId) => Migrations.Keys .Where( _idGenerator.IsValidId(nameOrId) // ReSharper disable once ImplicitlyCapturedClosure ? (Func <string, bool>)(id => string.Equals(id, nameOrId, StringComparison.OrdinalIgnoreCase)) : id => string.Equals(_idGenerator.GetName(id), nameOrId, StringComparison.OrdinalIgnoreCase)) .FirstOrDefault();