private static void CloneIndexes(IReadOnlyEntityType sourceEntityType, IMutableEntityType targetEntityType) { foreach (var index in sourceEntityType.GetDeclaredIndexes()) { var clonedIndex = targetEntityType.AddIndex( index.Properties.Select(p => targetEntityType.FindProperty(p.Name)).ToList()); clonedIndex.IsUnique = index.IsUnique; index.GetAnnotations().ForEach(annotation => clonedIndex[annotation.Name] = annotation.Value); } }