Quantcast
Channel: Entity Framework
Viewing all 10318 articles
Browse latest View live

Commented Task: Runtime Viability Checks failing due to new templates [2294]

$
0
0
New CSharp and VB EntityFramework.CodeTemplates have been added to the build. These cause the runtime viability checks to fail on the CI machines.
Comments: ^^ Checkin #7fe3718. is in the EFBuild Repo, not the EntityFramework main repo

Closed Task: Runtime Viability Checks failing due to new templates [2294]

$
0
0
New CSharp and VB EntityFramework.CodeTemplates have been added to the build. These cause the runtime viability checks to fail on the CI machines.
Comments: Verified fixed

Commented Feature: Consider creating native images of EF runtime during EF Designer setup [2288]

$
0
0
As explained at http://msdn.microsoft.com/en-us/data/dn582034, using NGen can shave up to 3 seconds of application startup in 64 bit applications. If we could queue up the EF assemblies for ngen in the EF Designer's setup it would speed up development for applications using the same version of the runtime we ship in the box. It has limited reach but it can potentially be easy to add this to our WiX scripts.

A possible drawback is that it would increase our effective footprint on disk.
Comments: Fixed in commit [f31811a3](https://entityframework.codeplex.com/SourceControl/changeset/f31811a32fd65973f0d8bc4ebaefd3e4c6dd4be8)

Commented Issue: [Perf] Regression between 6.1 and 6.1.1 for some queries on TPT model [2296]

$
0
0
The following model/query:

```
public class MyBase
{
public int Id { get; set; }
}

public class MyDerived1 : MyBase
{
public string Name { get; set; }
public MyDerived2 Der2 { get; set; }
}

public class MyDerived2 : MyBase
{
public string Name { get; set; }
public MyDerived1 Der1 { get; set; }
}

public class MyContext : DbContext
{
public DbSet<MyBase> Bases { get; set; }

protected override void OnModelCreating(DbModelBuilder builder)
{
builder.Entity<MyBase>().ToTable("MyBase");
builder.Entity<MyDerived2>().HasOptional(e => e.Der1).WithOptionalDependent(e => e.Der2);
builder.Entity<MyDerived1>().ToTable("Der1");
builder.Entity<MyDerived2>().ToTable("Der2");
}
}

ctx.Bases.OfType<MyDerived2>().Where(e => e.Der1.Der2.Name == "Foo");

```

In 6.1 the following SQL is produced:

```
SELECT
[Extent1].[Id] AS [Id],
'0X0X' AS [C1],
[Extent1].[Name] AS [Name],
CAST(NULL AS varchar(1)) AS [C2],
[Extent1].[Der1_Id] AS [Der1_Id]
FROM [dbo].[Der2] AS [Extent1]
INNER JOIN [dbo].[Der2] AS [Extent2] ON (([Extent2].[Der1_Id] = [Extent1].[Der1_Id]) OR (([Extent2].[Der1_Id] IS NULL) AND ([Extent1].[Der1_Id] IS NULL))) AND ([Extent1].[Der1_Id] IS NOT NULL)
WHERE ([Extent2].[Der1_Id] IS NOT NULL) AND (N'Foo' = [Extent2].[Name])
```

However in 6.1.1 query is much more complex:

```
SELECT
[Project1].[Id] AS [Id],
[Project1].[C1] AS [C1],
[Project1].[Name] AS [Name],
[Project1].[C2] AS [C2],
[Project1].[Der1_Id] AS [Der1_Id]
FROM ( SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Der1_Id] AS [Der1_Id],
[Extent1].[Name] AS [Name],
'0X0X' AS [C1],
CAST(NULL AS varchar(1)) AS [C2],
[Join2].[Der1_Id1] AS [Der1_Id1],
[Join2].[Name1] AS [Name1],
[Join2].[Id1] AS [Id1],
[Join2].[Id2] AS [Id2],
[Join2].[Der1_Id2] AS [Der1_Id2]
FROM [dbo].[Der2] AS [Extent1]
LEFT OUTER JOIN (SELECT [Extent2].[Der1_Id] AS [Der1_Id1], [Extent2].[N
ame] AS [Name1], [Join1].[Id1], [Join1].[Id2], [Join1].[Der1_Id2]
FROM [dbo].[Der2] AS [Extent2]
INNER JOIN (SELECT [Extent3].[Id] AS [Id1], [Extent4].[Id] AS [Id2]
, [Extent4].[Der1_Id] AS [Der1_Id2]
FROM [dbo].[Der1] AS [Extent3]
INNER JOIN [dbo].[Der2] AS [Extent4] ON ([Extent4].[Der1_Id] IS
NOT NULL) AND ([Extent3].[Id] = [Extent4].[Der1_Id]) ) AS [Join1] ON [Join1].[Id
1] = [Extent2].[Der1_Id] ) AS [Join2] ON [Extent1].[Id] = [Join2].[Id2]
) AS [Project1]
WHERE N'Foo' = [Project1].[Name1]
```

Comments: I just saw the comments you posted on https://entityframework.codeplex.com/Workitem/2369, so please ignore my previous post

Closed Issue: [Perf] Regression between 6.1 and 6.1.1 for some queries on TPT model [2296]

$
0
0
The following model/query:

```
public class MyBase
{
public int Id { get; set; }
}

public class MyDerived1 : MyBase
{
public string Name { get; set; }
public MyDerived2 Der2 { get; set; }
}

public class MyDerived2 : MyBase
{
public string Name { get; set; }
public MyDerived1 Der1 { get; set; }
}

public class MyContext : DbContext
{
public DbSet<MyBase> Bases { get; set; }

protected override void OnModelCreating(DbModelBuilder builder)
{
builder.Entity<MyBase>().ToTable("MyBase");
builder.Entity<MyDerived2>().HasOptional(e => e.Der1).WithOptionalDependent(e => e.Der2);
builder.Entity<MyDerived1>().ToTable("Der1");
builder.Entity<MyDerived2>().ToTable("Der2");
}
}

ctx.Bases.OfType<MyDerived2>().Where(e => e.Der1.Der2.Name == "Foo");

```

In 6.1 the following SQL is produced:

```
SELECT
[Extent1].[Id] AS [Id],
'0X0X' AS [C1],
[Extent1].[Name] AS [Name],
CAST(NULL AS varchar(1)) AS [C2],
[Extent1].[Der1_Id] AS [Der1_Id]
FROM [dbo].[Der2] AS [Extent1]
INNER JOIN [dbo].[Der2] AS [Extent2] ON (([Extent2].[Der1_Id] = [Extent1].[Der1_Id]) OR (([Extent2].[Der1_Id] IS NULL) AND ([Extent1].[Der1_Id] IS NULL))) AND ([Extent1].[Der1_Id] IS NOT NULL)
WHERE ([Extent2].[Der1_Id] IS NOT NULL) AND (N'Foo' = [Extent2].[Name])
```

However in 6.1.1 query is much more complex:

```
SELECT
[Project1].[Id] AS [Id],
[Project1].[C1] AS [C1],
[Project1].[Name] AS [Name],
[Project1].[C2] AS [C2],
[Project1].[Der1_Id] AS [Der1_Id]
FROM ( SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Der1_Id] AS [Der1_Id],
[Extent1].[Name] AS [Name],
'0X0X' AS [C1],
CAST(NULL AS varchar(1)) AS [C2],
[Join2].[Der1_Id1] AS [Der1_Id1],
[Join2].[Name1] AS [Name1],
[Join2].[Id1] AS [Id1],
[Join2].[Id2] AS [Id2],
[Join2].[Der1_Id2] AS [Der1_Id2]
FROM [dbo].[Der2] AS [Extent1]
LEFT OUTER JOIN (SELECT [Extent2].[Der1_Id] AS [Der1_Id1], [Extent2].[N
ame] AS [Name1], [Join1].[Id1], [Join1].[Id2], [Join1].[Der1_Id2]
FROM [dbo].[Der2] AS [Extent2]
INNER JOIN (SELECT [Extent3].[Id] AS [Id1], [Extent4].[Id] AS [Id2]
, [Extent4].[Der1_Id] AS [Der1_Id2]
FROM [dbo].[Der1] AS [Extent3]
INNER JOIN [dbo].[Der2] AS [Extent4] ON ([Extent4].[Der1_Id] IS
NOT NULL) AND ([Extent3].[Id] = [Extent4].[Der1_Id]) ) AS [Join1] ON [Join1].[Id
1] = [Extent2].[Der1_Id] ) AS [Join2] ON [Extent1].[Id] = [Join2].[Id2]
) AS [Project1]
WHERE N'Foo' = [Project1].[Name1]
```

Comments: Closing, the issue reported by customer is tracked separately: https://entityframework.codeplex.com/Workitem/2369 This is unrelated to SqlCE, but rather the complexity of the query.

Closed Feature: Consider creating native images of EF runtime during EF Designer setup [2288]

$
0
0
As explained at http://msdn.microsoft.com/en-us/data/dn582034, using NGen can shave up to 3 seconds of application startup in 64 bit applications. If we could queue up the EF assemblies for ngen in the EF Designer's setup it would speed up development for applications using the same version of the runtime we ship in the box. It has limited reach but it can potentially be easy to add this to our WiX scripts.

A possible drawback is that it would increase our effective footprint on disk.
Comments: Verified that EF generates an NGen'd DLLs when EFTools are installed after this fix went into the build

Commented Unassigned: [Perf] Regression between 6.1 and 6.1.1 [2369]

$
0
0
See the attached program. The generated SQL in 6.1.1 looks similar to the problem in issue 2296.
Reading 1000 rows takes about 45 seconds on my machine.

I tried installing 6.1 in this demo code, but it generates the same query. I assure you that in my production code a similar query had only one join and completed reading >20k rows in less than a second.
Comments: Thanks Daniel for verifying.

Created Unassigned: Implement support for providing name for Primary Key constraint/index [2416]

$
0
0
From SO http://stackoverflow.com/q/24986280/2908362 ...

By convention, EF generates "PK_<_Schema_>.<_TableName_>" as the backing index name for an entity primary key.

I would like to provide specific names for my primary keys, and I've been unable to locate any specific annotation or FluentAPI syntax which permits overriding the default behavior.

Cheers,

Sam.

Source code checked in, #2663cdaa8a0723c5d828b5f9779077773af14740

Source code checked in, #0c2224accc760421bf605b73ee25120de50865b7

$
0
0
Merge branch 'master' of https://git01.codeplex.com/entityframework

Edited Feature: Migrations: Hekaton extensibility TODO list [2345]

$
0
0
Tracking changes needed to Migrations extensibility in order to enable Hekaton scenarios.

- Make WriteCreateTable protected virtual.

Commented Feature: Migrations: Hekaton extensibility TODO list [2345]

$
0
0
Tracking changes needed to Migrations extensibility in order to enable Hekaton scenarios.

- Make WriteCreateTable protected virtual.

Comments: Fixed in changeset 2663cdaa8a0723c5d828b5f9779077773af14740

Edited Feature: Migrations: Hekaton extensibility TODO list [2345]

$
0
0
Tracking changes needed to Migrations extensibility in order to enable Hekaton scenarios.

- Make WriteCreateTable protected virtual.

Edited Unassigned: Inline Expression reference results in 1025 provider error [2412]

$
0
0
if I have an expression defined something like this:

```
public Expression<Func<AclProjectOrganization, bool>> ProjectOrganzationFilter(params Guid[] objIDs)
{
return po => objIDs.Contains(po.ProjectID);
}
```

And I create it like this:

var exp = ProjectOrganizationFilter(SomeObjectID)

Then use it in a Linq to Entities query, all is fine and it works fine.

However, if I do something like this:

DataContext.SomeSet.Where(ss => ProjectOrganizationFilter(ss.ID))

I get 1025 provider errors. This should be a supported case and should work correctly.

Thanks!

Edited Unassigned: Inline Expression reference results in 1025 provider error [2412]

$
0
0
if I have an expression defined something like this:

```
public Expression<Func<AclProjectOrganization, bool>> ProjectOrganzationFilter(params Guid[] objIDs)
{
return po => objIDs.Contains(po.ProjectID);
}
```

And I create it like this:

```
var exp = ProjectOrganizationFilter(SomeObjectID)
```

Then use it in a Linq to Entities query, all is fine and it works fine.

However, if I do something like this:

```
DataContext.SomeSet.Where(ss => ProjectOrganizationFilter(ss.ID))
```

I get 1025 provider errors. This should be a supported case and should work correctly.

Thanks!

Commented Unassigned: A decimal place is appended to a field of type decimal(10,0) [2415]

$
0
0
In my database I have a field which I know will always be 10 digits long, so naturally I've opted for a decimal(10,0) type, when I insert values into the table I can insert any number up to 10 digits long, however when I insert an entity with EF6 it adds a 0 decimal and then throws a parameter out of range value. The type of the field in my C# code is decimal. Here is the error:

![Image](http://i.stack.imgur.com/thsyz.png)

Here is the entity immediately before I add it to the data context and call SaveChanges():

![Image](http://i.stack.imgur.com/p3vct.png)

Just to make sure, here is the column in Sql Server:

![Image](http://i.stack.imgur.com/GMK2P.png)

Is this a bug?

Comments: I was able to reproduce the behavior as follows: ``` public class Foo { public int Id { get; set; } public decimal DecimalProperty { get; set; } } public class MyContext : DbContext { public DbSet<Foo> Foos { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<Foo>().Property(p => p.DecimalProperty).HasPrecision(10, 0); } } class Program { static void Main(string[] args) { using (var ctx = new MyContext()) { var foo = new Foo { DecimalProperty = 1234567890.0M }; ctx.Foos.Add(foo); ctx.SaveChanges(); } } } ``` however, the scenario works for the following: ``` var foo = new Foo { DecimalProperty = 1234567890M }; ``` Note that for the first case (1234567890.0M) the debugger will display the value as 1234567890. Is there a chance that in your code the NationalIdNo is created in the same format? (xxxxxxxxxx.0M) This shouldn't really matter (and for sql server it doesn;t) but for some it makes a difference for sql client. You can reproduce this behavior without EF as follows: ``` class Program { static void Main(string[] args) { var connection = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=Investigate2415.MyContext;Integrated Security=True;MultipleActiveResultSets=True"); connection.Open(); try { var command = new SqlCommand(); command.Connection = connection; command.CommandText = @"INSERT [dbo].[Foos]([DecimalProperty]) VALUES (@0)"; decimal foo = 1234567890.0M; var parameter = new SqlParameter("@0", foo); parameter.Precision = 10; parameter.Scale = 0; command.Parameters.Add(parameter); command.ExecuteNonQuery(); } finally { connection.Close(); } } } ``` So most likely it is a SqlClient bug

Commented Issue: Test failures against SQL Azure with new OFFSET syntax [2394]

$
0
0
The [recent changes to enable OFFSET for paging queries against SQL Server 2012 or greater](https://entityframework.codeplex.com/SourceControl/changeset/431b48ec28d1ade4b9367987a54053f34df106ac) are causing test failures when running tests against SQL Azure. Initial investigation shows that this is not a product issue but just a bug in test logic: while we generate the new syntax for SQL Azure, somehow we still expect the old syntax to be generated.
Comments: fixed in eeae6d4ef9fc197fcd1b4b66f3034e399019c38b

Closed Issue: Test failures against SQL Azure with new OFFSET syntax [2394]

$
0
0
The [recent changes to enable OFFSET for paging queries against SQL Server 2012 or greater](https://entityframework.codeplex.com/SourceControl/changeset/431b48ec28d1ade4b9367987a54053f34df106ac) are causing test failures when running tests against SQL Azure. Initial investigation shows that this is not a product issue but just a bug in test logic: while we generate the new syntax for SQL Azure, somehow we still expect the old syntax to be generated.
Comments: this is now fixed, closing

Closed Feature: Migrations: Hekaton extensibility TODO list [2345]

$
0
0
Tracking changes needed to Migrations extensibility in order to enable Hekaton scenarios.

- Make WriteCreateTable protected virtual.

Comments: straightforward change, closing

Commented Unassigned: Inline Expression reference results in 1025 provider error [2412]

$
0
0
if I have an expression defined something like this:

```
public Expression<Func<AclProjectOrganization, bool>> ProjectOrganzationFilter(params Guid[] objIDs)
{
return po => objIDs.Contains(po.ProjectID);
}
```

And I create it like this:

```
var exp = ProjectOrganizationFilter(SomeObjectID)
```

Then use it in a Linq to Entities query, all is fine and it works fine.

However, if I do something like this:

```
DataContext.SomeSet.Where(ss => ProjectOrganizationFilter(ss.ID))
```

I get 1025 provider errors. This should be a supported case and should work correctly.

Thanks!
Comments: @Geminiman: I would expect your get compiler errors with this code (not sure if that is what you mean by "1025 provider errors"). When the C# compiler compiles the call to Queryable.Where() it needs an argument that matches the signature or the method, e.g. the argument can either be of type Expression<Func<AclProjectOrganization, bool>> or Func<AclProjectOrganization, bool>>. (If it is the latter, the compiler will do some additional work to capture the argument expression as an Expression<Func<AclProjectOrganization, bool>>). In the following line: ... var query = DataContext.SomeSet.Where(ss => ProjectOrganizationFilter(ss.ID)); ... The arguments happens to be of the type Expression<Func<AclProjectOrganization,Expression<Func<AclProjectOrganization,bool>>>>, which doesn't match any of the types expected by the Where method. If am guessing correctly what you want to do, there are ways to achieve something similar. Here are some examples: - Implement the specification pattern using LINQ: Here is an interesting approach I found today, but I have seen others: http://nblumhardt.com/archives/implementing-the-specification-pattern-via-linq/ - Capture a variable from the method into the query, e.g. write the query like this instead: ... var projecOrg = GetProjectOrg(); var query = DataContext.SomeSet.Where(ProjectOrganizationFilter(projectOrg.ID)); ... This works here because the ProjectOrganizationFilter method return type matches the expect type for Queryable.Where() - LINQKit is a library that provides extensions for LINQ providers. It would allow you to write the query more or less like this: ... var guid = GetGuid(); var query = DataContext.SomeSet.AsExpandable().Where(ss => ProjectOrganizationFilter(guid).Compile().Invoke(ss)); ...
Viewing all 10318 articles
Browse latest View live




Latest Images