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

Edited Feature: Entity Framework Should Support ISupportInitialize [1957]

$
0
0
It would be fantastic if when creating entity instances, EF would support calling the methods on the ISupportInitialize interface if the entity implemented it. Basically Activator.CreateInstance -> ISupportInitialize.BeginInit -> Load All Properties and perform fix up -> ISupportInitialize.EndInit -> return instance.

This allows advanced components to switch behaviors to allow use with technologies such as Code Contracts easier than is usual with EF by knowing if we're able to "break the rules" due to batched changes to the current entity (usually done via ISupportInitializeNotification).

Commented Feature: Entity Framework Should Support ISupportInitialize [1957]

$
0
0
It would be fantastic if when creating entity instances, EF would support calling the methods on the ISupportInitialize interface if the entity implemented it. Basically Activator.CreateInstance -> ISupportInitialize.BeginInit -> Load All Properties and perform fix up -> ISupportInitialize.EndInit -> return instance.

This allows advanced components to switch behaviors to allow use with technologies such as Code Contracts easier than is usual with EF by knowing if we're able to "break the rules" due to batched changes to the current entity (usually done via ISupportInitializeNotification).
Comments: __EF Team Triage:__ We agree this could be an interesting thing to support, but our team isn't planning to work on it for the upcoming releases. We're moving it to the Future release as we may consider it in the future. This does not exclude someone outside of our team contributing the feature in an upcoming release.

Edited Feature: UpForGrabs: SQL Server Compact data provider for EF does not support some Entity SQL canonical functions [1962]

$
0
0
This is a re-post of the Connect issue http://connect.microsoft.com/SQLServer/feedback/details/812735, as suggested by ErikEJ on the SQL Compact forum (http://social.msdn.microsoft.com/Forums/sqlserver/en-US/819bb6d2-88b5-4832-9ea0-e8975465848d).

Problem description:
System.Data.SqlServerCe.Entity (v. 4.0) doesn't support some Entity SQL canonical functions. The complete support for canonical functions is vital important for database-agnostic applications using Entity Framework.
For instance, there is no support for such essential string functions as Edm.Contains, Edm.Starts and Edm.EndsWith, which apparently can be translated to CHARINDEX or LIKE operators. In fact, the CLR method String.StartsWith() is supported by the provider at LINQ-to-Entity level and gets indeed translated to CHARINDEX. But with ESQL, it does not. At the same time, the opposite method String.EndsWith(), leads to a weird exception “The function 'Reverse' is not supported by SQL Server Compact”, when using LINQ-to-Entity.
Even worse is the fact, that the ESQL translator doesn’t report the unsupported functions and just put them in the resulting SQL “as is”. This means, a round-trip to the database engine is required to detect an invalid query.

Moreover, there should be a documented mapping between EDM canonical and SQL Server Compact functions, as it exists for SQL Client: http://msdn.microsoft.com/en-us/library/cc716715.aspx.

I'll provide a simple repro soon.

Commented Feature: UpForGrabs: SQL Server Compact data provider for EF does not support some Entity SQL canonical functions [1962]

$
0
0
This is a re-post of the Connect issue http://connect.microsoft.com/SQLServer/feedback/details/812735, as suggested by ErikEJ on the SQL Compact forum (http://social.msdn.microsoft.com/Forums/sqlserver/en-US/819bb6d2-88b5-4832-9ea0-e8975465848d).

Problem description:
System.Data.SqlServerCe.Entity (v. 4.0) doesn't support some Entity SQL canonical functions. The complete support for canonical functions is vital important for database-agnostic applications using Entity Framework.
For instance, there is no support for such essential string functions as Edm.Contains, Edm.Starts and Edm.EndsWith, which apparently can be translated to CHARINDEX or LIKE operators. In fact, the CLR method String.StartsWith() is supported by the provider at LINQ-to-Entity level and gets indeed translated to CHARINDEX. But with ESQL, it does not. At the same time, the opposite method String.EndsWith(), leads to a weird exception “The function 'Reverse' is not supported by SQL Server Compact”, when using LINQ-to-Entity.
Even worse is the fact, that the ESQL translator doesn’t report the unsupported functions and just put them in the resulting SQL “as is”. This means, a round-trip to the database engine is required to detect an invalid query.

Moreover, there should be a documented mapping between EDM canonical and SQL Server Compact functions, as it exists for SQL Client: http://msdn.microsoft.com/en-us/library/cc716715.aspx.

I'll provide a simple repro soon.
Comments: __EF Team Triage:__ We agree this would be a good change, but our team isn't planning to work on it for the upcoming releases. We're moving it to the Future release as we may consider it in the future. This does not exclude someone outside of our team contributing the feature in an upcoming release.

Closed Unassigned: Some nice features I wish [1956]

$
0
0
Great work team, actually I really love Entity framework than any of other ORM frameworks.
Can you kindly let me know when EF will support, or is it possible to support below features:
1.batch insert / update / delete ? I mean I can insert/update/delete multiple rows just in a single round trip to the database.
2.delete an entity simply by passing a Lambda expression without having to get the entity first, for example: students.delete(s => s.StudentID == "123456")
3.a more natural left/right join syntax like SQL, maybe a new keyword "leftjoin" or "rightjoin", for example:

```
var orderUsers = from u in db.Users
leftjoin o in db.Orders on u.UserID equals o.UserID
select new {u.UserName,o.OrderNumber}
```

Actually, the current syntax to do a left / right join, and group by also, is very not natural. So it would be great if Linq to Entities could support a more SQL-style syntax
Comments: #1 is a duplicate of https://entityframework.codeplex.com/workitem/53 #2 is a duplicate of https://entityframework.codeplex.com/workitem/52 #3 would actually be a feature in LINQ itself (that EF would then be able to support in its LINQ provider) rather than a purely EF feature. To be honest, I don't see this one happening.

Closed Unassigned: Referential integrity constraint violation - View ->Table Association [1954]

$
0
0
I have added a question to stackoverflow but does not seem to get any traction, I believe this bug is to do with entity framework core, if anyone can provide some assistance or tell me what is wrong with it, I would appreciate it. All details can be found at http://stackoverflow.com/questions/20851635/referential-integrity-constraint-violation-a-dependent-role-has-multiple-princ
Comments: __EF Team Triage:__ We agree this is a bug but because it requires a very particular/uncommon pattern in the model and would be very expensive/complicated to fix we are not planning to fix it. Possible workarounds are to remove the pattern from the model or specify temporary key values (see first comment from moozyk for more details).

Closed Unassigned: Improve database first model generation on subsequent updates [1955]

$
0
0
When using the designer to update an existing model from a database there are some scenarios that do not update properly. My use case scenario is based around only doing database first and doing every single table, view and sproc in my database in one edmx. So I never want to manually edit my edmx. I just want to sync against the database to pull in any new tables, columns, sproc changes, etc. EF currently has some problems with this. It should update the edmx at all times to properly match the database. Saying I have to manually edit anything in the edmx totally defeats the purpose of "database first" for my purpose.

I did some tests of various scenarios and here is what works and doesn't.

1. Add brand new table to DB then update model - WORKS
2. Add new column to existing table - WORKS
3. Change the data type on existing column - FAILS. Still shows old data type
4. Remove column from an existing table - FAILS. Doesn't remove it.

5. Add new sproc to database then update model - WORKS
6. Change the input parameters of existing sproc - WORKS
7. Change sproc result set from a single value to actual result set - FAIL
ex. Change from SELECT 1 as Col1 hard coded to SELECT 1 as Col1, 'Test' as Col2. First scenario makes it an int return type. Second should be a custom complex type. It will never switch it. Only way to fix this is in the designer to use the model browser and delete both the function import and stored proc. Then reupdate the model from the database.
8. Change columns in the result set - FAIL. Exact same issue as #7.
Any changes to the sproc columns and output seems to never update properly.

My expectation is all of these things should work. Perhaps "database first" is mean to be "database once" and not reused over and over. But my idea of it should be more complete syncing. I would suggest adding a checkbox in the designer that just says "overwrite my model" or something that blows away those entities as they exist and completely updates them to what the database says.

I can understand why people would do database first and then add a column to the model. However, I think they can just as easily do it with a partial class and not touch the emdx. That way the edmx is in sync with the database and if they want to extend the entity class to add other fields, they can do so in their own code in partial classes.

For my purposes I would be even happier to have edmgen2 work properly to produce an edmx for the database. Currently it does not work with stored procedures properly. But I do strongly feel the UI should also do complete database model syncing properly.

The most frustrating of all about EF is even if I go in and delete everything in the EDMX and try to just rebuild the whole thing by syncing from the database again, it doesn't really work. I believe it works for tables but it doesn't for stored procedures. I can't actually open the designer and delete the stored procedures for example all at once. You have to use the model browser part of it and delete them which is a complete nightmare if you have a lot of stored procedures.

Simply put, how EF works in regards to database first only sort of works and is a nightmare for real world use. Database first to me sets the expectation that I don't plan on manually modifying my entities or writing any code. I want to just sync it from the database. I want what sqlmetal or edmgen do basically.


Comments: __EF Team Triage:__ This is mostly By Design, parts of the conceptual model are preserved when you update from the database (just storage and mapping are updated). This is to allow you to edit the conceptual model without loosing changes when you update. We agree this could definitely have been implemented better and only preserved changes that you actually make to the conceptual model. Unfortunately this is fundamental to the way the designer is implemented and we can not spend the time/resources to re-implement it. While not ideal, deleting and re-creating the EDMX is a reasonable work around to achieve the desired behavior.

Closed Unassigned: multiple result not work [1953]

$
0
0
Good day.

I have a code

```
var spReader = modelContainer.sp_TestResutl();
var arrays = spReader.ToArray();

var nextResult = spReader.GetNextResult<SomeResult>();
```

and i have __nextResult is null__, but store return 2 tables.

modelContainer is __DbContext on EF 6.0.2__ from Nuget
has alternative error from outher coders:
http://stackoverflow.com/q/18624519
Comments: __EF Team Triage:__ Unfortunately the lower level components we use for database interaction don't enable us to support this from the wizard. Therefore implementing this would be extremely time consuming and require re-implementing a lot of the designer. Whilst we agree it would be good to support, we don't think it is worth the very high cost given that there are ways to use multiple result sets already (although they require more work).

Commented Unassigned: EF 6.x EntityObject Generator: SetValidValue misses third parameter [1938]

$
0
0
Hi,

I had to upgrade an EF4 model to EF6. This was quite easy using the EF 6.x EntityObject Generator. The one and only error was in the setter of a complex property:

> _Error 47 The best overloaded method match for 'System.Data.Entity.Core.Objects.DataClasses.StructuralObject.SetValidValue(byte[], bool)' has some invalid arguments

SetValidValue wants the property name as third parameter. This parameter is missing in the code template file. I'm not sure about this but I think the solution is adding a third parameter in the following statement of the "WriteComplexTypeProperty" method:

```
<#=code.FieldName(complexProperty)#> = SetValidValue(<#=code.FieldName(complexProperty)#>, value, "<#=complexProperty.Name#>");
```

At least this works for me.

Regards


Comments: Hi, Many thanks for the repro project. We will work on getting the fix out. Your solution to add in the third value to WriteComplexTypeProperty is correct. For anyone else hitting the issue it's Line 690 in <modelName.tt> that should be updated to: ``` <#=code.FieldName(complexProperty)#> = SetValidValue(<#=code.FieldName(complexProperty)#>, value, "<#=complexProperty.Name#>"); ``` ~Rowan

Created Issue: Migrations :: switching the order of composite keys fails when coupled with 1-many relationship [1968]

$
0
0
Consider the following model:

```
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public ICollection<Employee> Reports { get; set; }
}

public class MyContext : DbContext
{
public DbSet<Employee> Employees { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Employee>().HasKey(e => new { e.FirstName, e.LastName });
}
}
```

Enable-Migrations
Add-Migration Mig1
Update-Database

now, switch the order of the composite key as follows:

```
modelBuilder.Entity<Employee>().HasKey(e => new { e.LastName, e.FirstName });
```

Add-Migration Mig2 will generate:

```
public override void Up()
{
DropForeignKey("dbo.Employees", new[] { "Employee_LastName", "Employee_FirstName" }, "dbo.Employees");
DropIndex("dbo.Employees", new[] { "Employee_LastName", "Employee_FirstName" });
RenameColumn(table: "dbo.Employees", name: "Employee_FirstName", newName: "__mig_tmp__0");
RenameColumn(table: "dbo.Employees", name: "Employee_LastName", newName: "Employee_FirstName");
RenameColumn(table: "dbo.Employees", name: "__mig_tmp__0", newName: "Employee_LastName");
DropPrimaryKey("dbo.Employees");
AddPrimaryKey("dbo.Employees", new[] { "LastName", "FirstName" });
CreateIndex("dbo.Employees", new[] { "Employee_LastName", "Employee_FirstName" });
AddForeignKey("dbo.Employees", new[] { "Employee_LastName", "Employee_FirstName" }, "dbo.Employees", new[] { "LastName", "FirstName" });
}
```

This is wrong, when checking for the "old" key constraint we are using the new name, and hence the old key is not dropped.

Upon Update-Database exception will be thrown:

The constraint 'PK_dbo.Employees' is being referenced by table 'Employees', foreign key constraint 'FK_dbo.Employees_dbo.Employees_Employee_FirstName_Employee_LastName'.
Could not drop constraint. See previous errors.
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, Boolean asyncWrite)
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.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TInterceptionContext,TResult](Func`1 operation, TInterceptionContext interceptionContext, Action`1 executing, Action`1 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement, DbInterceptionContext interceptionContext)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement, DbInterceptionContext interceptionContext)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable`1 migrationStatements, DbConnection connection)
at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClass32.<ExecuteStatements>b__2e()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation)
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, IEnumerable`1 systemOperations, 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.UpdateInternal(String targetMigration)
at System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b()
at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
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.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
ClientConnectionId:e310c1c6-ef89-4719-ae28-40ff0d30d26d

Edited Issue: myget nightly builds stalled [1965]

$
0
0
Looks like nothing new since dec 20 last year...

Commented Unassigned: EF 6.x EntityObject Generator: SetValidValue misses third parameter [1938]

$
0
0
Hi,

I had to upgrade an EF4 model to EF6. This was quite easy using the EF 6.x EntityObject Generator. The one and only error was in the setter of a complex property:

> _Error 47 The best overloaded method match for 'System.Data.Entity.Core.Objects.DataClasses.StructuralObject.SetValidValue(byte[], bool)' has some invalid arguments

SetValidValue wants the property name as third parameter. This parameter is missing in the code template file. I'm not sure about this but I think the solution is adding a third parameter in the following statement of the "WriteComplexTypeProperty" method:

```
<#=code.FieldName(complexProperty)#> = SetValidValue(<#=code.FieldName(complexProperty)#>, value, "<#=complexProperty.Name#>");
```

At least this works for me.

Regards


Comments: This also affects the __EF 5.x EntityObject Generator__ the fix is the same but the line number is 682 for that template.

Edited Task: Build: Make the FwLinks configurable by version number [FixedIn6.1.0-alpha1] [1818]

$
0
0
Make the FwLinks configurable by version number

Edited Issue: DbContext data validation topics missing in MSDN documentation [1534]

$
0
0
I did a search in MSDN and all I could find where the blog post that are "marked as obsolete".

Edited Feature: Consider generalized mechanism for registering services in config file [765]

$
0
0
Scenario: Someone creates an EF pluralization service for some language. It should be possible to ship this in a NuGet package and have that NuGet package automatically register the service when it is installed. This either requires that the service is registered in DbConfiguration, which may not be being used, or in the config file. But the config file only allows certain services to be registered using bespoke XML. This is good for readability and necessary for back compat, but it would also be good to have a general mechanism which allows any service to be registered. We might also look at making it easy to change DbConfiguration if it is present, especially for Windows Store scenarios.

Edited Issue: Update CE provider to use public types from EF assembly [FixedIn6.1.0-alpha1] [AffectedLastRTM] [435]

$
0
0
Make the types public first if it makes sense.

From code:
internal static bool IsUnboundedFacetValue(Facet facet)
{
// TODO: vamshikb
// Use return object.ReferenceEquals(facet.Value, EdmConstants.UnboundedValue);
// when EdmConstants.UnboundedValue is made public.
return (null == facet.Value || facet.IsUnbounded);
}

private static bool IsStoreFunction(EdmFunction function)
{
// TODO: pragyaa. make it public in parent.
// return function.BuiltInAttribute;
return (bool)function.MetadataProperties["BuiltInAttribute"].Value && !TypeHelpers.IsCanonicalFunction(function);
}

internal static TypeUsage GetElementTypeUsage(TypeUsage type)
{
if (TypeSemantics.IsCollectionType(type))
{
return ((CollectionType)type.EdmType).TypeUsage;
}
else if (TypeSemantics.IsReferenceType(type))
{
// TODO: pragyaa. Uncomment code when TypeUsage constructor
// has been made public.
// We should typically not reach this code path anyway.
//
//return new TypeUsage(((RefType)type.EdmType).ElementType);
throw new NotSupportedException(String.Empty);
}
return null;
}

Closed Task: [Doc] Write topic about using NGEN with EF [1855]

$
0
0
Consider:
- Motivation
- Bitness
- Providers
- Verification

Edited Task: [Doc] Write topic about using NGEN with EF [1855]

$
0
0
Consider:
- Motivation
- Bitness
- Providers
- Verification

Created Task: API review for API surface changes in 6.1.0 [1974]

$
0
0
Created this new API review work item and renamed #[1926](https://entityframework.codeplex.com/workitem/1926) since most of the later is mostly about know issues in commit failure handling that should be addressed by Andriy before we actually do an API review for 6.1.0.

Edited Task: API review for API surface changes in 6.1.0 [1974]

$
0
0
Created this new API review work item and renamed #[1926](https://entityframework.codeplex.com/workitem/1926) since most of the later is mostly about know issues in commit failure handling that should be addressed by Andriy before we actually do an API review for 6.1.0.
Viewing all 9566 articles
Browse latest View live


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