Quantcast
Channel: entityframework Issue Tracker Rss Feed
Viewing all 9566 articles
Browse latest View live

Edited Issue: An enum in a different assembly triggers "The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type" for EF4.x app on .NET 4.5 [596]

$
0
0
We're using EF 4.3.1 code-first under .NET 4.0 and VS2012. We have a query that looks similar to the following:

ctx.Set<Entities.A>().Select(a => new DTO.A { Id = a.Id, Name = a.Name }).ToArray();

Entities.A is defined in an assembly called Entities and DTO.A is defined in an assembly called DTO. Under VS2010 EF 4.3 this worked fine, but under EF 5.0 it throws the following exception:

Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'A'. Previously found CLR type 'Entities.A', newly found CLR type 'DTO.A'.

Stack trace is

at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action'1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection)
at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly)
at System.Data.Objects.ELinq.ExpressionConverter.TryGetValueLayerType(Type linqType, TypeUsage& type)
at System.Data.Objects.ELinq.ExpressionConverter.GetCastTargetType(TypeUsage fromType, Type toClrType, Type fromClrType, Boolean preserveCastForDateTime)
at System.Data.Objects.ELinq.ExpressionConverter.CreateCastExpression(DbExpression source, Type toClrType, Type fromClrType)
at System.Data.Objects.ELinq.ExpressionConverter.ConvertTranslator.TranslateUnary(ExpressionConverter parent, UnaryExpression unary, DbExpression operand)
at System.Data.Objects.ELinq.ExpressionConverter.UnaryTranslator.TypedTranslate(ExpressionConverter parent, UnaryExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.UnaryTranslator.TypedTranslate(ExpressionConverter parent, UnaryExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MemberInitTranslator.TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MemberInitTranslator.TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateSet(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.UnarySequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.Convert()
at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)

I'd understand the problem if the types were in the same assembly (a long documented issue with EF whereby it cannot disambiguate using just the entity name), but from a different assembly?

Is this a regression, it used to work...?

Edited Issue: An enum in a different assembly triggers type loading, causing "The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type" for EF4.x app on .NET 4.5 [596]

$
0
0
We're using EF 4.3.1 code-first under .NET 4.0 and VS2012. We have a query that looks similar to the following:

ctx.Set<Entities.A>().Select(a => new DTO.A { Id = a.Id, Name = a.Name }).ToArray();

Entities.A is defined in an assembly called Entities and DTO.A is defined in an assembly called DTO. Under VS2010 EF 4.3 this worked fine, but under EF 5.0 it throws the following exception:

Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'A'. Previously found CLR type 'Entities.A', newly found CLR type 'DTO.A'.

Stack trace is

at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action'1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection)
at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly)
at System.Data.Objects.ELinq.ExpressionConverter.TryGetValueLayerType(Type linqType, TypeUsage& type)
at System.Data.Objects.ELinq.ExpressionConverter.GetCastTargetType(TypeUsage fromType, Type toClrType, Type fromClrType, Boolean preserveCastForDateTime)
at System.Data.Objects.ELinq.ExpressionConverter.CreateCastExpression(DbExpression source, Type toClrType, Type fromClrType)
at System.Data.Objects.ELinq.ExpressionConverter.ConvertTranslator.TranslateUnary(ExpressionConverter parent, UnaryExpression unary, DbExpression operand)
at System.Data.Objects.ELinq.ExpressionConverter.UnaryTranslator.TypedTranslate(ExpressionConverter parent, UnaryExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.UnaryTranslator.TypedTranslate(ExpressionConverter parent, UnaryExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MemberInitTranslator.TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MemberInitTranslator.TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateSet(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.UnarySequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.Convert()
at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)

I'd understand the problem if the types were in the same assembly (a long documented issue with EF whereby it cannot disambiguate using just the entity name), but from a different assembly?

Is this a regression, it used to work...?

Edited Issue: An enum in a different assembly triggers type loading, causing "The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type" for EF4.x app on .NET 4.5 [596]

$
0
0
We're using EF 4.3.1 code-first under .NET 4.0 and VS2012. We have a query that looks similar to the following:

ctx.Set<Entities.A>().Select(a => new DTO.A { Id = a.Id, Name = a.Name }).ToArray();

Entities.A is defined in an assembly called Entities and DTO.A is defined in an assembly called DTO. Under VS2010 EF 4.3 this worked fine, but under EF 5.0 it throws the following exception:

Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'A'. Previously found CLR type 'Entities.A', newly found CLR type 'DTO.A'.

Stack trace is

at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action'1 logLoadMessage)
at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection)
at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly)
at System.Data.Objects.ELinq.ExpressionConverter.TryGetValueLayerType(Type linqType, TypeUsage& type)
at System.Data.Objects.ELinq.ExpressionConverter.GetCastTargetType(TypeUsage fromType, Type toClrType, Type fromClrType, Boolean preserveCastForDateTime)
at System.Data.Objects.ELinq.ExpressionConverter.CreateCastExpression(DbExpression source, Type toClrType, Type fromClrType)
at System.Data.Objects.ELinq.ExpressionConverter.ConvertTranslator.TranslateUnary(ExpressionConverter parent, UnaryExpression unary, DbExpression operand)
at System.Data.Objects.ELinq.ExpressionConverter.UnaryTranslator.TypedTranslate(ExpressionConverter parent, UnaryExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.UnaryTranslator.TypedTranslate(ExpressionConverter parent, UnaryExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MemberInitTranslator.TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MemberInitTranslator.TypedTranslate(ExpressionConverter parent, MemberInitExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression lambda, DbExpression input, DbExpressionBinding& binding)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, DbExpression& source, DbExpressionBinding& sourceBinding, DbExpression& lambda)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SelectTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateSet(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.UnarySequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod)
at System.Data.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq)
at System.Data.Objects.ELinq.ExpressionConverter.Convert()
at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)

I'd understand the problem if the types were in the same assembly (a long documented issue with EF whereby it cannot disambiguate using just the entity name), but from a different assembly?

Is this a regression, it used to work...?

Edited Issue: Designer: All primary keys should be clustered (affects SQL Azure) [592]

$
0
0
I designed an entity data model with two entities between which there exists a many to many relationship. When I auto-generate SQL code to generate the database for this model, it has generated a table (two columns) to keep track of this many-to-many association. However, this table has a PRIMARY KEY NONCLUSTERED on both columns.

This is extremely annoying because I've to do manual workarounds to deal with this issue, when supposedly the sql generated by the EF is azure compatible.

Issue was already reported in stackoverflow.
http://stackoverflow.com/questions/3567946/entity-framework-many-to-many-clustered-vs-nonclustered-index

Can you please fix this with urgency?
Thanks

Edited Issue: Applying migration causes maximum length error [550]

$
0
0
I created a project with multiple models and migrations enabled for both models. I then updated the model from EF5 to EF6. Next I tried to update one of the models using automatic migration, this resulted in this error:
Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Warning! The maximum key length is 900 bytes. The index 'PK___NewMigrationHistory.__MigrationHistory' has maximum length of 1534 bytes. For some combination of large values, the insert/update operation will fail.

I have a repro project but it is too large to attach, below is the stack trace for the error:

System.Data.SqlClient.SqlException (0x80131904): Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Warning! The maximum key length is 900 bytes. The index 'PK___NewMigrationHistory.__MigrationHistory' has maximum length of 1534 bytes. For some combination of large values, the insert/update operation will fail.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable`1 migrationStatements)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.ExecuteStatements(IEnumerable`1 migrationStatements)
at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, XDocument targetModel, IEnumerable`1 operations, Boolean downgrading, Boolean auto)
at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
ClientConnectionId:49f4f462-1b12-4cb8-b4fa-ae4d119b5009
Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Warning! The maximum key length is 900 bytes. The index 'PK___NewMigrationHistory.__MigrationHistory' has maximum length of 1534 bytes. For some combination of large values, the insert/update operation will fail.

Edited Issue: Problem resolving mapping and metadata from non-POCO ObjectContext [519]

$
0
0
When using ObjectContext and EDMX in a project with two entities (with one *.* association) the mapping information seems to be missing.

ClrPerspective.TryGetTypeByName(...) attempts to resolve the type mapping from OSpace when the EDM type is actually stored in CSpace. The lookup fails, thus forcing an InvalidOperationException with the following message: "Mapping and metadata information could not be found for EntityType 'System.Data.Entity.Model.Supplier'."

The project seems quite standard and works as expected when reproduced in Dev10.

Commented Feature: Make DbCollectionEntry, DbReferenceEntry.IsLoaded settable [269]

$
0
0
I want to be able to write something like this:

db.Entry(room).Collection(r => r.Users).IsLoaded = true;
room.Users.Add(user); // this doesn't trigger lazy loading because i already marked the collection as loaded. Without this, I have to turn off lazy loading in the whole context.
Comments: See also a more detail description of use case in http://entityframework.codeplex.com/workitem/884. Please make this also available for ObjectContext and RelatedEnd (EntityCollection<T>). Thanks

Created Issue: Changing namespaces breaks WCF data services server [896]

$
0
0
If I upgrade a working solution using WCF data services 5.3.0 and EF 5.0 to use EF 6.0 alpha 2, I get this error:

```
<p>The server encountered an error processing the request. The exception message is 'Expression of type 'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for return type 'System.Data.Objects.ObjectContext''. See server logs for more details. The exception stack trace is: </p>
<p> at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression&amp; body, ReadOnlyCollection`1 parameters)
at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)
at System.Data.Services.Providers.DbContextHelper.CreateDbContextAccessor(Type type)
at System.Data.Services.Providers.DbContextHelper.GetDbContextAccessor(Type type)
at System.Data.Services.DataService`1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider&amp; metadataProviderInstance, IDataServiceQueryProvider&amp; queryProviderInstance, BaseServiceProvider&amp; builtInProvider, Object&amp; dataSourceInstance)
at System.Data.Services.DataService`1.CreateProvider()
at System.Data.Services.DataService`1.HandleRequest()
at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody)
at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
```

This occurs because the namespace of ObjectContext has changed.

Created Issue: DbMigrations - AddOrUpdate: CaseSensitive? [897]

$
0
0
Hi,
I use AddOrUpdate for my migration steps but it happens that a key I want to compare with is in a different case in the database as in my migration object.

for example:
context.SystemConfigurations.AddOrUpdate(
p => new { p.SystemConfigurationTypeId, p.Key },
systemConfigurations);

I have no way to specify that the property `p.Key` has to be case insensitive checked what brings me to the point where I have to do the whole thing again manually.

This is the affected file:
http://entityframework.codeplex.com/SourceControl/changeset/view/b9c9370ce807#src/EntityFramework/Migrations/IDbSetExtensions.cs

Cheers

Commented Issue: Designer: Localization: The default entity name, Entity1, and entityset name, Entity1, are overlocalized in the Add Entity dialog box [700]

$
0
0
repro steps:
1. Create a project with KO VS
2. Add the ADO.NET Entity Data Model diagram
3. Add new entity
4. The default name of the new entity, and entity set are localized as in the attached image.

Expected:
They should not be localized since those names are used as class names, and they use English as class names.

Actual:
The default entity name, Entity1, and entityset name, Entity1, are overlocalized.

Comments: The relevant resource is Model_DefaultEntityTypeName in Microsoft.Data.Entity.Design.Model.Resources.

Commented Issue: Some of the ToTable methods ignore schema included in name [894]

$
0
0
Mapping an entity to a table with a name in the format "schema.table" does not always work as expected. The following will map Blog to the schema name:
```
modelBuilder.Entity<Blog>().ToTable("Schema.TableName");
```
But the following will not, EF will attempt to add dbo to the start of the name:
```
modelBuilder.Entity(typeof(Blog)).ToTable("Schema.TableName");
```
The ToTable methods inside a many-to-many mapping configuration also do not parse the schema.


The workaround for this is to use the overload of ToTable that accepts schema name:
```
modelBuilder.Entity(typeof(blog)).ToTable("TableName", "Schema");
```
Comments: This may be related to [Work Item 716](http://entityframework.codeplex.com/workitem/716).

Commented Issue: TPT Inheritance with composite foreign key in derived type [865]

$
0
0
[Stack Overflow Issue 1](http://stackoverflow.com/q/13179634/1791547)
[Stack Overflow Issue 2](http://stackoverflow.com/q/10961690/1791547)

EF throws a configuration error when trying to map a Table Per Type model where the _Derived type contains a composite foreign key_ to another type, but one part of the _composite key is defined in the Base Type_ as a composite _primary key._

The main problem seems to be that EF does not see that TenantID is going to be in the derived table. And ordinarily it would be right, but in this case, TenantID is part of the key so will actually be in both tables.

This type of derived type mapping seems perfectly normal and it works perfectly fine without this composite key situation. So this seems like a bug.
Comments: **EF Team Triage:** This is part of a more fundamental limitation where EF doesn't support having a property defined in a base type and then using it as a foreign key in a derived type. Unfortunately this is a limitation that would be very hard to remove from our code base. Given that we haven't seen a lot of requests for it, it's not something we are planning to address at this stage so we are closing this issue.

Closed Issue: TPT Inheritance with composite foreign key in derived type [865]

$
0
0
[Stack Overflow Issue 1](http://stackoverflow.com/q/13179634/1791547)
[Stack Overflow Issue 2](http://stackoverflow.com/q/10961690/1791547)

EF throws a configuration error when trying to map a Table Per Type model where the _Derived type contains a composite foreign key_ to another type, but one part of the _composite key is defined in the Base Type_ as a composite _primary key._

The main problem seems to be that EF does not see that TenantID is going to be in the derived table. And ordinarily it would be right, but in this case, TenantID is part of the key so will actually be in both tables.

This type of derived type mapping seems perfectly normal and it works perfectly fine without this composite key situation. So this seems like a bug.
Comments: **EF Team Triage:** This is part of a more fundamental limitation where EF doesn't support having a property defined in a base type and then using it as a foreign key in a derived type. Unfortunately this is a limitation that would be very hard to remove from our code base. Given that we haven't seen a lot of requests for it, it's not something we are planning to address at this stage so we are closing this issue.

Commented Issue: Designer: Localization: The default entity name, Entity1, and entityset name, Entity1, are overlocalized in the Add Entity dialog box [700]

$
0
0
repro steps:
1. Create a project with KO VS
2. Add the ADO.NET Entity Data Model diagram
3. Add new entity
4. The default name of the new entity, and entity set are localized as in the attached image.

Expected:
They should not be localized since those names are used as class names, and they use English as class names.

Actual:
The default entity name, Entity1, and entityset name, Entity1, are overlocalized.

Comments: The relevant resource is Model_DefaultEntityTypeName in Microsoft.Data.Entity.Design.Model. This controls the default EntityType name (subject to being uniquified within the model first). The default EntitySet name is derived from the EntityType name. If Korean users would prefer an English default that's fine - all that's required is that the KO version of this resource be the English value. (Note: I believe that we should keep the localization - e.g. French and German users will probably appreciate these defaults being in French and German respectively.)

Commented Issue: Update-Database fails when working from a mapped network drive [856]

$
0
0
Updating worked from a local drive, stopped working after moving to a network drive and started working again after moving back to a local drive.
Directories are binary identical (except for obj and bin directories).

Windows 7 x64, Visual Studio 2010.

```
PM> Update-Database -Verbose -Force
Using StartUp project 'MyFirstProject'.
Using NuGet project 'MySecondProject'.
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.PowerShell.Utility.dll
' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:398 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $toolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

You cannot call a method on a null-valued expression.
At L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:399 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.PowerShell.d
ll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
```
Comments: **EF Team Triage:** The migrations commands require full trust to run. Because you are running from a network share it looks like you are running in a lower trust level. In the past we have made the decision that the migrations commands would require full trust because it reduces the complexity of the implementation.

Closed Issue: Update-Database fails when working from a mapped network drive [856]

$
0
0
Updating worked from a local drive, stopped working after moving to a network drive and started working again after moving back to a local drive.
Directories are binary identical (except for obj and bin directories).

Windows 7 x64, Visual Studio 2010.

```
PM> Update-Database -Verbose -Force
Using StartUp project 'MyFirstProject'.
Using NuGet project 'MySecondProject'.
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.PowerShell.Utility.dll
' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:398 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $toolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

You cannot call a method on a null-valued expression.
At L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:399 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.PowerShell.d
ll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At L:\MySolution\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
```
Comments: **EF Team Triage:** The migrations commands require full trust to run. Because you are running from a network share it looks like you are running in a lower trust level. In the past we have made the decision that the migrations commands would require full trust because it reduces the complexity of the implementation.

Commented Issue: Changing namespaces breaks WCF data services server [896]

$
0
0
If I upgrade a working solution using WCF data services 5.3.0 and EF 5.0 to use EF 6.0 alpha 2, I get this error:

```
<p>The server encountered an error processing the request. The exception message is 'Expression of type 'System.Data.Entity.Core.Objects.ObjectContext' cannot be used for return type 'System.Data.Objects.ObjectContext''. See server logs for more details. The exception stack trace is: </p>
<p> at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression&amp; body, ReadOnlyCollection`1 parameters)
at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)
at System.Data.Services.Providers.DbContextHelper.CreateDbContextAccessor(Type type)
at System.Data.Services.Providers.DbContextHelper.GetDbContextAccessor(Type type)
at System.Data.Services.DataService`1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider&amp; metadataProviderInstance, IDataServiceQueryProvider&amp; queryProviderInstance, BaseServiceProvider&amp; builtInProvider, Object&amp; dataSourceInstance)
at System.Data.Services.DataService`1.CreateProvider()
at System.Data.Services.DataService`1.HandleRequest()
at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody)
at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
```

This occurs because the namespace of ObjectContext has changed.
Comments: Thanks moozzyk - that makes sense. I considered writing a custom WCF data services provider, but that would blow up the scope of my implementation, so it was easier to roll back to EF 5. I submitted this case both to flag the issue, and because there's no place for me to submit bugs to the WCF data services team (afaict - I'm assuming UserVoice is more of a black hole).

Edited Issue: Designer: Localization: The default entity name, Entity1, and entityset name, Entity1, are overlocalized in the Add Entity dialog box [700]

$
0
0
repro steps:
1. Create a project with KO VS
2. Add the ADO.NET Entity Data Model diagram
3. Add new entity
4. The default name of the new entity, and entity set are localized as in the attached image.

Expected:
They should not be localized since those names are used as class names, and they use English as class names.

Actual:
The default entity name, Entity1, and entityset name, Entity1, are overlocalized.

Edited Feature: Give DbGeography support for polygons with holes [728]

$
0
0
The DbGeopgaphy type does not support to access to the individual rings of a singe polygon having holes. Please add support to access the inner rings defining the holes via the ExteriorRing InteriorRingCount and InteriorRingAt members, like it works for DbGeometry already.

I don't understand why this is working for DbGeometry but not for DbGeography. In the SqlGeography class it works just fine, so I am forced to use the ProviderValue and SqlServer.Types assembly as a workaround which creates an unnecessary dependency in the project.

The DbSpatialServices class already offers these features so I think it would only mead adding a few lines to the DbGeography class.

Commented Feature: Give DbGeography support for polygons with holes [728]

$
0
0
The DbGeopgaphy type does not support to access to the individual rings of a singe polygon having holes. Please add support to access the inner rings defining the holes via the ExteriorRing InteriorRingCount and InteriorRingAt members, like it works for DbGeometry already.

I don't understand why this is working for DbGeometry but not for DbGeography. In the SqlGeography class it works just fine, so I am forced to use the ProviderValue and SqlServer.Types assembly as a workaround which creates an unnecessary dependency in the project.

The DbSpatialServices class already offers these features so I think it would only mead adding a few lines to the DbGeography class.
Comments: **EF Team Triage:** We discussed and agreed that we should support this. Unfortunately it's not going to fit into the EF6 release so we're putting it in the Future release to prioritize for a future release. This does not exclude someone from outside the EF team contributing this feature into the EF6 release.
Viewing all 9566 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>