В моем проекте я использую Entity Framework с MySQL.этот код:
objectContext.users.Include("posts").Take(2).ToList()
выдает исключение: System.ArgumentNullException: Value cannot be null. Parameter name: key
с такой трассировкой стека:
[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +12670485
MySql.Data.Entity.Scope.GetFragment(String name) +27
MySql.Data.Entity.SelectStatement.AddDefaultColumns(Scope scope) +177
MySql.Data.Entity.SelectStatement.Wrap(Scope scope) +90
MySql.Data.Entity.SelectGenerator.WrapJoinInputIfNecessary(InputFragment fragment, Boolean isRightPart) +251
MySql.Data.Entity.SelectGenerator.HandleJoinExpression(DbExpressionBinding left, DbExpressionBinding right, DbExpressionKind joinType, DbExpression joinCondition) +110
MySql.Data.Entity.SelectGenerator.Visit(DbJoinExpression expression) +33
MySql.Data.Entity.SqlGenerator.VisitInputExpression(DbExpression e, String name, TypeUsage type) +50
MySql.Data.Entity.SelectGenerator.VisitInputExpressionEnsureSelect(DbExpression e, String name, TypeUsage type) +19
MySql.Data.Entity.SelectGenerator.Visit(DbProjectExpression expression) +45
MySql.Data.Entity.SqlGenerator.VisitInputExpression(DbExpression e, String name, TypeUsage type) +50
MySql.Data.Entity.SelectGenerator.VisitInputExpressionEnsureSelect(DbExpression e, String name, TypeUsage type) +19
MySql.Data.Entity.SelectGenerator.Visit(DbSortExpression expression) +61
MySql.Data.Entity.SqlGenerator.VisitInputExpression(DbExpression e, String name, TypeUsage type) +50
MySql.Data.Entity.SelectGenerator.VisitInputExpressionEnsureSelect(DbExpression e, String name, TypeUsage type) +19
MySql.Data.Entity.SelectGenerator.Visit(DbProjectExpression expression) +45
MySql.Data.Entity.SelectGenerator.GenerateSQL(DbCommandTree tree) +73
MySql.Data.MySqlClient.MySqlProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree) +401
System.Data.EntityClient.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree) +608
Интересно, что objectContext.users.Take(2).ToList()
или objectContext.users.Include("posts").ToList()
работает нормально.
Кто-нибудь сталкивался с этой проблемой?