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

Reviewed: EF 6.1.2 (5月 19, 2015)

$
0
0
Rated 5 Stars (out of 5) - Thanks For Your Share!

Commented Unassigned: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name"Advantage.Data.Provider" Make sure the provider is registered...... [2739]

$
0
0
I am writing a custom EF6 provider.I am able to connect to a database and also see the tables after making changes in app.config.

While using the functionality of Generate Database from model, I am getting Null reference exception in GetAlldAssociationSets() On debugging my SASDLtoADS.tt file, I found that I get the above error (error 0152 ..) in CreateStoreItemCollection().
If EF was not registered properly , in app.config file , then shouldn't I also get an error while connecting to the database?
I have registered my Data Provider in GAC and also my EF provider in GAC.
What all steps could I try to resolve this error?

Attaching App.config file.

Comments: I could see the following entries in my machine.config file. ``` <system.data> <DbProviderFactories> <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> <add name="Advantage Data Provider" invariant="Advantage.Data.Provider" description=".Net Framework Data Provider for Advantage Database Server" type="Advantage.Data.Provider.AdsFactory, Advantage.Data.Provider, Version=12.00.2.0, Culture=neutral, PublicKeyToken=e33137c86a38dc06" /> </DbProviderFactories> </system.data> ``` Please note that type in machine config is Advantage.Data.Provider.AdsFactory AdsFactory is not a part of EF6 implementation but is a part of basic .net provider.

Commented Unassigned: StackOverFlowException [2750]

$
0
0
Very occasionally I receive the following StackOverFlowException when our product is starting up.

Not sure what the mechanism that triggers this is.

The following is repeated to the maximum number of stack frames supported by Visual Studio.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

mscorlib.dll!System.Enum.GetValue() Unknown
mscorlib.dll!System.Enum.ToString() Unknown
mscorlib.dll!string.Concat(object arg0, object arg1) Unknown
> EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.BuildKeyExpressionForNewEntityOp(System.Data.Entity.Core.Query.InternalTrees.Op op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.NewEntityOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitAncillaryOpDefault(System.Data.Entity.Core.Query.InternalTrees.AncillaryOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitAncillaryOpDefault(System.Data.Entity.Core.Query.InternalTrees.AncillaryOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ScanViewOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.ProcessScanTable(System.Data.Entity.Core.Query.InternalTrees.Node scanTableNode, System.Data.Entity.Core.Query.InternalTrees.ScanTableOp scanTableOp, ref System.Data.Entity.Core.Query.InternalTrees.IsOfOp typeFilter) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ScanTableOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ScanViewOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.ProcessScanTable(System.Data.Entity.Core.Query.InternalTrees.Node scanTableNode, System.Data.Entity.Core.Query.InternalTrees.ScanTableOp scanTableOp, ref System.Data.Entity.Core.Query.InternalTrees.IsOfOp typeFilter) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ScanTableOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.FilterOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.BuildRelPropertyExpression(System.Data.Entity.Core.Metadata.Edm.EntitySetBase entitySet, System.Data.Entity.Core.Query.InternalTrees.RelProperty relProperty, System.Data.Entity.Core.Query.InternalTrees.Node keyExpr) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.BuildAllRelPropertyExpressions() Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.NewEntityOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitAncillaryOpDefault(System.Data.Entity.Core.Query.InternalTrees.AncillaryOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitDefault(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfNode.VisitAncillaryOpDefault(System.Data.Entity.Core.Query.InternalTrees.AncillaryOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ProjectOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ScanViewOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.ProcessScanTable(System.Data.Entity.Core.Query.InternalTrees.Node scanTableNode, System.Data.Entity.Core.Query.InternalTrees.ScanTableOp scanTableOp, ref System.Data.Entity.Core.Query.InternalTrees.IsOfOp typeFilter) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.PreProcessor.Visit(System.Data.Entity.Core.Query.InternalTrees.ScanTableOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitChildren(System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown
EntityFramework.dll!System.Data.Entity.Core.Query.PlanCompiler.SubqueryTrackingVisitor.VisitRelOpDefault(System.Data.Entity.Core.Query.InternalTrees.RelOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) Unknown

Comments: Hi, Could you provide some code that we could use to reproduce this issue? I understand that it takes some time to reproduce, but some code we could run repetitively to try and reproduce the issue is probably the only way we can really debug what's happening. ~Rowan

Closed Unassigned: ef migration code based [2742]

$
0
0
Hello, I'm starting to turn migration manuals in my solution.
But I have a problem, it is several days that I could not understand.

My solution is divided into several projects, a project for the view (Sedna.UI) a project for the db where are my entity and my contexts. (Sedna.Domain).

I have 3 contexts, 2 have automatic migrations while the main one I would turn migration manual (SednaContext)

Nuget package manager console there is a dropdown and I select the Default project "Sedna.Domain" then when i run Enable-Migrations -ContextTypeName Sedna.Domain.UnitOfWork.SednaContext ... I get an error: "No migrations configuration type 'Sedna .Domain.Migrations.Configuration 'was found in the assembly "Sedna.Domain" "while I find him in the project.

I'm going crazy I do not understand why?
I have add a screencats


EDIT:
I noticed that the error was due because the project settings, in compilations was put x86, if I put AnyCPU work, why?
Comments: __EF Team Triage:__ The environment that we execute migrations in generally requires that all projects have the same platform selected. You may be able to get it working in some mixed scenarios, but the scenario we support is when they are all the same.

Commented Feature: Consider making DbContext.Entry() method (and other members of DbContext) virtual [2741]

$
0
0
Moving this from https://github.com/aspnet/EntityFramework/issues/2088

[@alisabzevari](https://github.com/alisabzevari) said:
> Many of methods in DbContext are virtual. So they can be mocked using Moq or similar frameworks. But Entry is not virtual. [Searching the net](http://www.asp.net/web-api/overview/testing-and-debugging/mocking-entity-framework-when-unit-testing-aspnet-web-api-2#dependency) made me accept that the better way to mock this method is to write a MarkAsModified method in our DbContext. I think this is not a clean way. Is it possible to make Entry method as virtual or create IDbContext interface?
Comments: @alisabzevari - did you want to send a pull request for this one?

Closed Unassigned: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name"Advantage.Data.Provider" Make sure the provider is registered...... [2739]

$
0
0
I am writing a custom EF6 provider.I am able to connect to a database and also see the tables after making changes in app.config.

While using the functionality of Generate Database from model, I am getting Null reference exception in GetAlldAssociationSets() On debugging my SASDLtoADS.tt file, I found that I get the above error (error 0152 ..) in CreateStoreItemCollection().
If EF was not registered properly , in app.config file , then shouldn't I also get an error while connecting to the database?
I have registered my Data Provider in GAC and also my EF provider in GAC.
What all steps could I try to resolve this error?

Attaching App.config file.

Comments: **EF Team Triage:** EF6 providers need to be ADO.NET providers with the additional capabilities for EF added. You would need to implement the ADO.NET provider surface and register your provider with an invariant name.

Closed Unassigned: Customize EF Designer Wizard to be able to add new items [2732]

$
0
0
I want to be able to customize Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.ModelObjectItemWizard

So I can add my custom items to Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.ModelBuilderWizardForm like I show on this updated screenshot

![Customized EF Designer Wizard](https://www.codeplex.com/Download/AttachmentDownload.ashx?ProjectName=entityframework&WorkItemId=2732&FileAttachmentId=1457550)

In particular I want to add "ASP.NET Identity 2.0 EF Designer model" which will already contain all the entities required for ASP.NET Identity 2.0 to work.

What I exactly need is at least to be able to add an item with custom icon with particular order into first page of Wizard and if my item is chosen I want to get access to EDMX file and update its content.
Be able to use Visual Studio API to add entities to the model would be excellent.
Comments: __EF Team Triage:__ Seems like questions are answered. Feel free to re-open if not.

Edited Feature: Consider making DbContext.Entry() method (and other members of DbContext) virtual [2741]

$
0
0
Moving this from https://github.com/aspnet/EntityFramework/issues/2088

[@alisabzevari](https://github.com/alisabzevari) said:
> Many of methods in DbContext are virtual. So they can be mocked using Moq or similar frameworks. But Entry is not virtual. [Searching the net](http://www.asp.net/web-api/overview/testing-and-debugging/mocking-entity-framework-when-unit-testing-aspnet-web-api-2#dependency) made me accept that the better way to mock this method is to write a MarkAsModified method in our DbContext. I think this is not a clean way. Is it possible to make Entry method as virtual or create IDbContext interface?

Updated Release: EF 6.2.0

Commented Feature: Consider making DbContext.Entry() method (and other members of DbContext) virtual [2741]

$
0
0
Moving this from https://github.com/aspnet/EntityFramework/issues/2088

[@alisabzevari](https://github.com/alisabzevari) said:
> Many of methods in DbContext are virtual. So they can be mocked using Moq or similar frameworks. But Entry is not virtual. [Searching the net](http://www.asp.net/web-api/overview/testing-and-debugging/mocking-entity-framework-when-unit-testing-aspnet-web-api-2#dependency) made me accept that the better way to mock this method is to write a MarkAsModified method in our DbContext. I think this is not a clean way. Is it possible to make Entry method as virtual or create IDbContext interface?
Comments: I'd love to, but I didn't do this because I don't know what would be the side effects of making this method virtual. If it is ok to just make that virtual I will do this, if it is not please help me to do that.

Commented Issue: [Performance] Projection With Null Check Causing Too Many Joins [2196]

$
0
0
I am attempting to use Projection with Null Check (Added in regards to https://entityframework.codeplex.com/workitem/826)

Expanding upon the example given in the issue, adding multiple properties to the address DTO object gives the following select:

```
.Select(
customer =>
new CustomerDto
{
Id = customer.Id,
FirstName = customer.FirstName,
Address =
(customer.Address != null) ?
new AddressDto {
AddressLine1 = customer.Address.AddressLine1,
AddressLine2= customer.Address.AddressLine2,
City= customer.Address.City,
State = customer.Address.State,
Zip = customer.Address.Zip } :
null
})
```

This works fine and generates a query with a single join on the addresses table.

If we assume for the sake of this post that there is another navigation property on customer, called Location, that you first have to navigate through to get to Address, the query now looks like:

```
.Select(
customer =>
new CustomerDto
{
Id = customer.Id,
FirstName = customer.FirstName,
Address =
(customer.Address != null) ?
new AddressDto {
AddressLine1 = customer.Location.Address.AddressLine1,
AddressLine2= customer.Location.Address.AddressLine2,
City= customer.Location.Address.City,
State = customer.Location.Address.State,
Zip = customer.Location.Address.Zip } :
null
})
```

This is generating a query with a LEFT OUTER JOIN for each property on the AddressDto object. Each join only pulls back a single property from the Address table.

So, instead of having a select from the customers table with one left outer join to the Locations table and one left outer join to the Address table, we instead get a query with a single left outer join to the Locations table and 5 left outer joins to the Address table, one for each property in the DTO.
Comments: We are using OData querys ($select, $expand) to filter out required properties and doing an explicit Join defeats the purpose.

Created Unassigned: LINQ Query orderby + where ==> no rows (v6.1.3) [2751]

$
0
0
###Entity Framework 6.1.3

I have an entity called __Folder__. I have a DbSet in a database context called __Folders__. The backing table contains 11 records. I am have trouble with LINQ queries against the DbSet when I combine an _orderby_ statement with any _where_ clause, where zero rows are returned!

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
select myFolder;
return myFolders.Count();
```

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

This, strangely enough, returns zero rows!
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

I am perplexed.

Commented Unassigned: LINQ Query orderby + where ==> no rows (v6.1.3) [2751]

$
0
0
###Entity Framework 6.1.3

I have an entity called __Folder__. I have a DbSet in a database context called __Folders__. The backing table contains 11 records. I am have trouble with LINQ queries against the DbSet when I combine an _orderby_ statement with any _where_ clause, where zero rows are returned!

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
select myFolder;
return myFolders.Count();
```

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

This, strangely enough, returns zero rows!
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

I am perplexed.
Comments: This is embarrassing. This turned out to be a non-issue. The problem was subtle. It has been found, and eliminated. I just don't know if it is possible to delete an issue. (Feel free to delete this one.)

Edited Unassigned: LINQ Query orderby + where ==> no rows (v6.1.3) [2751]

$
0
0
#Non-Issue

_How does on delete issues that turn out to be non-issues? Please ignore this._

I have an entity called __Folder__. I have a DbSet in a database context called __Folders__. The backing table contains 11 records. I am have trouble with LINQ queries against the DbSet when I combine an _orderby_ statement with any _where_ clause, where zero rows are returned!

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
select myFolder;
return myFolders.Count();
```

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

This, strangely enough, returns zero rows!
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

I am perplexed.

Edited Unassigned: (To Be Deleted) Non-Issue [2751]

$
0
0
#Non-Issue

_How does on delete issues that turn out to be non-issues? Please ignore this._

I have an entity called __Folder__. I have a DbSet in a database context called __Folders__. The backing table contains 11 records. I am have trouble with LINQ queries against the DbSet when I combine an _orderby_ statement with any _where_ clause, where zero rows are returned!

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
select myFolder;
return myFolders.Count();
```

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

This, strangely enough, returns zero rows!
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

I am perplexed.

Created Unassigned: A first chance exception of type 'System.IndexOutOfRangeException' [2752]

$
0
0
When calling Database.SqlQuery<T> and there is a type property that does not match the sql query result and while debugging I get the "A first chance exception of type 'System.IndexOutOfRangeException'"

Is there anyway "while debugging" to display the property/column that did not match

It would be great to know when there are properties that did not match instead of handling the error internally, or at least an option to throw the error so it can be caught with try/catch

Closed Unassigned: (To Be Deleted) Non-Issue [2751]

$
0
0
#Non-Issue

_How does on delete issues that turn out to be non-issues? Please ignore this._

I have an entity called __Folder__. I have a DbSet in a database context called __Folders__. The backing table contains 11 records. I am have trouble with LINQ queries against the DbSet when I combine an _orderby_ statement with any _where_ clause, where zero rows are returned!

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
select myFolder;
return myFolders.Count();
```

This returns 11 rows:
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

This, strangely enough, returns zero rows!
```
IQueryable<Folder> myFolders =
from myFolder in myContext.Folders
where true
orderby myFolder.Position, myFolder.Name
select myFolder;
return myFolders.Count();
```

I am perplexed.
Comments: Closing as requested

Edited Issue: UpForGrabs: A first chance exception of type 'System.IndexOutOfRangeException' [2752]

$
0
0
When calling Database.SqlQuery<T> and there is a type property that does not match the sql query result and while debugging I get the "A first chance exception of type 'System.IndexOutOfRangeException'"

Is there anyway "while debugging" to display the property/column that did not match

It would be great to know when there are properties that did not match instead of handling the error internally, or at least an option to throw the error so it can be caught with try/catch

Commented Issue: UpForGrabs: A first chance exception of type 'System.IndexOutOfRangeException' [2752]

$
0
0
When calling Database.SqlQuery<T> and there is a type property that does not match the sql query result and while debugging I get the "A first chance exception of type 'System.IndexOutOfRangeException'"

Is there anyway "while debugging" to display the property/column that did not match

It would be great to know when there are properties that did not match instead of handling the error internally, or at least an option to throw the error so it can be caught with try/catch
Comments: __EF Team Triage:__ Agreed this would be useful. We should still attempt just to get the property for the best perf, but fall back to some more complex code when there is an error. We aren't going to do this right now (relative priority to other tasks) but marking as UpForGrabs as it would make a good contribution.

Commented Issue: [Performance] Projection With Null Check Causing Too Many Joins [2196]

$
0
0
I am attempting to use Projection with Null Check (Added in regards to https://entityframework.codeplex.com/workitem/826)

Expanding upon the example given in the issue, adding multiple properties to the address DTO object gives the following select:

```
.Select(
customer =>
new CustomerDto
{
Id = customer.Id,
FirstName = customer.FirstName,
Address =
(customer.Address != null) ?
new AddressDto {
AddressLine1 = customer.Address.AddressLine1,
AddressLine2= customer.Address.AddressLine2,
City= customer.Address.City,
State = customer.Address.State,
Zip = customer.Address.Zip } :
null
})
```

This works fine and generates a query with a single join on the addresses table.

If we assume for the sake of this post that there is another navigation property on customer, called Location, that you first have to navigate through to get to Address, the query now looks like:

```
.Select(
customer =>
new CustomerDto
{
Id = customer.Id,
FirstName = customer.FirstName,
Address =
(customer.Address != null) ?
new AddressDto {
AddressLine1 = customer.Location.Address.AddressLine1,
AddressLine2= customer.Location.Address.AddressLine2,
City= customer.Location.Address.City,
State = customer.Location.Address.State,
Zip = customer.Location.Address.Zip } :
null
})
```

This is generating a query with a LEFT OUTER JOIN for each property on the AddressDto object. Each join only pulls back a single property from the Address table.

So, instead of having a select from the customers table with one left outer join to the Locations table and one left outer join to the Address table, we instead get a query with a single left outer join to the Locations table and 5 left outer joins to the Address table, one for each property in the DTO.
Comments: @dpnkarthik do you mean that you are still seeing the problem with the latest version of EF? We made other improvements to our JOIN elimination logic in recent releases and verified that a repro based on your report was fixed. That is why now this issue is closed. If you are still having issues, can you please file a new bug and include a full repro?
Viewing all 10318 articles
Browse latest View live




Latest Images