微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

EF序列包含多个元素

如何解决EF序列包含多个元素

我们有采用EF方法的MVC项目。 当我们要添加迁移时出现此错误

system.invalidOperationException:序列包含多个元素 在System.Linq.Enumerable.SingleOrDefault [TSource](IEnumerable 1 source) at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.<>c__displayClass76_1.<FindRenamedindexes>b__5(String c) at System.Linq.Enumerable.WhereSelectListIterator 2.MoveNext() 在System.Linq.Enumerable.SequenceEqual [TSource]处(IEnumerable 1 first,IEnumerable 1秒,IEqualityComparer 1 comparer) at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.<>c__displayClass76_0.<FindRenamedindexes>b__3(<>f__AnonymousType40 2 h__TransparentIdentifier1) 在System.Linq.Enumerable.WhereSelectEnumerableIterator 2.MoveNext() at System.Collections.Generic.List 1..ctor(IEnumerable 1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable 1来源)处 在System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff中(ModelMetadata源,ModelMetadata目标,Lazy 1 modificationCommandTreeGenerator,MigrationsqlGenerator migrationsqlGenerator,String sourceModelVersion,String targetModelVersion) at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel,XDocument targetModel,Lazy 1修改CommandTreeGenerator,MigrationsqlGenerator migrationsqlGenerator,String sourceModelVersion,String targetModelVersion) 在System.Data.Entity.Migrations.DbMigrator.Scaffold处(字符串migrationName,字符串名称空间,布尔值ignoreChanges) 在System.Data.Entity.Infrastructure.Design.Executor.ScaffoldInternal(字符串名称,DbConnectionInfo connectionInfo,字符串migrationsConfigurationName,布尔值ignoreChanges) 在System.Data.Entity.Infrastructure.Design.Executor.Scaffold。 c__displayClass0_0。 b__0() 在System.Data.Entity.Infrastructure.Design.Executor.OperationBase。 c__displayClass4_0`1.b__0() 在System.Data.Entity.Infrastructure.Design.Executor.OperationBase.Execute(动作) 序列包含多个元素

**我们为某些型号更改了一些键名,我不知道它是否相关

,我们发现没有任何解决方案可用于EF方法, 那么该错误的可能解决方案是什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。