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

Created Unassigned: Compatibility Issue Entity Data Source with EF 6.0 [2962]

$
0
0
Hello,

In a new Web Forms application with Entity Framework 6.0, I encounter the following problem when I try to configure the datasource of a GridView:

(see attachment)

I have updated all Nuget packages and as stated in the message I installed Microsoft.AspNet.EntityDataSource. All these installations went well but I still have the same problem.

What to do ? Is there a workaround for this problem?

Thanks in advance.


Edited Unassigned: Compatibility Issue Entity Data Source with EF 6.0 [2962]

$
0
0
Hello,

In a new Web Forms application (VS 2015) with Entity Framework 6.0, I encounter the following problem when I try to configure the datasource of a GridView:

(see attachment)

I have updated all Nuget packages and as stated in the message I installed Microsoft.AspNet.EntityDataSource. All these installations went well but I still have the same problem.

What to do ? Is there a workaround for this problem?

Thanks in advance.

Closed Unassigned: Schema breaking when attempting to reuse entity in Table Valued Function return type [2959]

$
0
0
This question is primarily about another framework, https://github.com/Dixin/EntityFramework.Functions which adds code-first support for things like Table Valued Functions.

I'm investigating why, when you try to reuse an entity type as a return type for a function, it breaks the schema representation of the database within EF. Specifically, I get these errors:

> Schema specified is not valid. Errors:
(0,0) : error 0040: The Type Int32 is not qualified with a namespace or alias. Only primitive types can be used without qualification.
(0,0) : error 0040: The Type String is not qualified with a namespace or alias. Only primitive types can be used without qualification.
(0,0) : error 0040: The Type Int32 is not qualified with a namespace or alias. Only primitive types can be used without qualification.
(0,0) : error 0040: The Type Int32 is not qualified with a namespace or alias. Only primitive types can be used without qualification.

The types referenced by these errors match the four properties within the model I'm attempting to reuse.

As I read the code for entityframework.functions, the return type for the function is constructed here

https://github.com/Dixin/EntityFramework.Functions/blob/master/EntityFramework.Functions/Function.DbModel.cs#L439

The relevant lines where the RowType is created

EntityType modelReturnParameterEntityType = modelReturnParameterStructuralType as EntityType;
if (modelReturnParameterEntityType != null)
{
storeReturnParameterRowType = RowType.Create(
modelReturnParameterEntityType.Properties.Select(property => property.Clone()),
null);
}

The result seems valid and is added to the ModelStore. The conceptual model is created, and the return value is generated here

https://github.com/Dixin/EntityFramework.Functions/blob/master/EntityFramework.Functions/Function.DbModel.cs#L568

The relevant portion of the method is here

if (functionAttribute.Type == FunctionType.TableValuedFunction)
{
// returnParameterInfo.ParameterType is IQueryable<T>.
Type returnParameterClrType = returnParameterInfo.ParameterType.GetGenericArguments().Single();
StructuralType modelReturnParameterStructuralType = model.GetModelStructualType(returnParameterClrType, methodInfo);
modelReturnParameterEdmTypes = Enumerable.Repeat(modelReturnParameterStructuralType, 1);
}

Again it appears that the already-defined model is found and used to generate the return value. Everything looks correct, and is added to the ConceptualModel.

For some reason this appears to break the schema of my model. I kinda doubt the answer as to why and the solution to fix it won't be initially obvious. But any hints/suggestions as to what might be happening and why, and how it might be fixed would be appreciated. A demo app is attached. I might have killed the entityframework.functions project when trying to get the zip in under the weight limit. If so, you can re-download it from the GitHub repository.

Comments: Thanks for reporting an issue on Entity Framework 6.x. This project is now maintained on GitHub (https://github.com/aspnet/EntityFramework6). Please file your issue on the GitHub issue tracker. **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Unassigned: DbSet.SqlQuery for entities with complex types [2960]

$
0
0
When DbSet.SqlQuery is used to retrieve entities that contain complex types as properties, the following exception is thrown.

System.InvalidOperationException: Cannot create a value for property '{name}' of type '{complex-type}'. Only properties of primitive or enumeration types are supported.

Example:


public class MyDbContext : DbContext
{
public DbSet<Person> People { get; set; }
}

public class Person
{
public virtual int Id { get; set; }
public virtual PersonName Name { get; set; }
}

public class PersonName
{
public string First { get; set; }
public string Last { get; set; }
}

class Program
{
static void Main(string[] args)
{
using (var db = new MyDbContext())
{
var query = db.People.SqlQuery("SELECT [Id], [Name_First], [Name_Last] FROM [dbo].[People]");
query.Count(); // throws exception
query.ToList(); // throws exception
}
}
}


Comments: Thanks for reporting an issue on Entity Framework 6.x. This project is now maintained on GitHub (https://github.com/aspnet/EntityFramework6). Please file your issue on the GitHub issue tracker. **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Unassigned: Error Entity Framework When use store procedure has the transaction [2961]

$
0
0
I get the error in entity framework when use store procedure has the transaction syntax. The store procedure successfully when execute use ADO.Net but i get this Error
> Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0


Any Solution ?
Thanks and regards,
Bahar
Comments: Thanks for reporting an issue on Entity Framework 6.x. This project is now maintained on GitHub (https://github.com/aspnet/EntityFramework6). Please file your issue on the GitHub issue tracker. **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Unassigned: Compatibility Issue Entity Data Source with EF 6.0 [2962]

$
0
0
Hello,

In a new Web Forms application (VS 2015) with Entity Framework 6.0, I encounter the following problem when I try to configure the datasource of a GridView:

(see attachment)

I have updated all Nuget packages and as stated in the message I installed Microsoft.AspNet.EntityDataSource. All these installations went well but I still have the same problem.

What to do ? Is there a workaround for this problem?

Thanks in advance.

Comments: Thanks for reporting an issue on Entity Framework 6.x. This project is now maintained on GitHub (https://github.com/aspnet/EntityFramework6). Please file your issue on the GitHub issue tracker. **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Task: Update Designer Extensibility Resources [1203]

$
0
0
We should clarify our story on extending the Entity Framework designer. Here are the few resources I was able to find online:

* [ADO.NET Entity Data Model Designer Extension Starter Kit ](http://archive.msdn.microsoft.com/DesignerExtStartKit) -- An outdated (VS 2010 RC) starter kit
* [Extending the Entity Data Model Tools](http://msdn.microsoft.com/en-us/library/ee373852.aspx) -- Our MSDN documentation
* [Entity Framework Starter Kit alternative](http://www.jradley.co.uk/1/post/2010/10/09/Entity-Framework-Starter-Kit-alternative) -- A version of the starter kit that has been updated by a community member (John R) to work with VS 2010 RTM & 2012

The starter kit published by Microsoft should be updated -- either to work, or to notify users that it is not up-to-date and redirect them to resources that are.
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Issue: If an entity MyEntity has a property called MyProp, I cannot create an entity called MyEntity_MyProp [2727]

$
0
0
Copied from github: https://github.com/aspnet/EntityFramework/issues/1979

I'm using Entity Framework 6, with POCO and fluent-API and I've noticed an annoying bug.

If I have an entity called MyEntity and this entity has a property called MyProp, that makes it impossible to create an entity called MyEntity_MyProp.

```
The item with identity 'MyEntity_MyProp' already exists in the metadata collection.\r\nParameter name: item
```

The error immediately goes away if I rename any of the entities, or rename the properties.

The "bug" is obvious: the key [EntityName]_[PropertyName] must be unique in the metadata collection.

Screenshot: (attached)

I'm migrating a huge Entity Framework model with 390+ classes from EF 4, database first, to EF 6, code first, with fluent-API. It's out of question to rename the entities or the tables.

How do I solve that?


Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Feature: UpForGrabs: Generate model from table with "computed" column [2728]

$
0
0
I have table in db that contains computed column with formula:

```
[AutogeneratedId] AS (newid())
```

When I generate model based on this table I have the following declaration :

```
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public Guid? AutogeneratedId { get; set; }
```

But I do not have anywhere information about formula that used for computed column => I need to set it again when I re-create db. Is there any way to set this formula in attributes or migration script?
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Issue: Outer apply in query. Also the SQL query seems nicer if generated with EF5. [2413]

$
0
0
This has been reported by the user fsoikin as part of issue [2196](https://entityframework.codeplex.com/workitem/2196) but seems to be caused by a different problem.

__Model:__

```
public class A
{
public int Id { get; set; }
public string Name { get; set; }
}

public class B
{
public int Id { get; set; }
public virtual ICollection<A> As { get; set; }
public virtual C C { get; set; }
}

public class C
{
public int Id { get; set; }
public string X { get; set; }
public int Y { get; set; }
}

public class Db : DbContext
{
public DbSet<A> As { get; set; }
public DbSet<B> Bs { get; set; }
public DbSet<C> Cs { get; set; }

public Db() : base( "server=.;database=xx;integrated security=true" ) {}
}

static class Program
{
static void Main() {
var db = new Db();
var q = from c in db.Bs
let i = c.As.FirstOrDefault().Id
let j = db.As.FirstOrDefault( a => a.Id == i ).Name
select new {
c.Id,
z = new { c.C.X, c.C.Y }
};
var qs = q.ToString();
}

```

__SQL query:__

```
SELECT
[Project2].[Id] AS [Id],
[Extent4].[X] AS [X],
[Extent5].[Y] AS [Y]
FROM (SELECT
[Extent1].[Id] AS [Id],
[Extent1].[C_Id] AS [C_Id],
(SELECT TOP (1)
[Extent2].[Id] AS [Id]
FROM [dbo].[A] AS [Extent2]
WHERE [Extent1].[Id] = [Extent2].[B_Id]) AS [C1]
FROM [dbo].[B] AS [Extent1] ) AS [Project2]
OUTER APPLY (SELECT TOP (1) [Extent3].[Id] AS [Id]
FROM [dbo].[A] AS [Extent3]
WHERE [Extent3].[Id] = [Project2].[C1] ) AS [Limit2]
LEFT OUTER JOIN [dbo].[C] AS [Extent4] ON [Project2].[C_Id] = [Extent4].[Id]
LEFT OUTER JOIN [dbo].[C] AS [Extent5] ON [Project2].[C_Id] = [Extent5].[Id]
```

__Workarounds:__

```
var q = from b in db.Bs
let i = b.As.FirstOrDefault().Id
let j = db.As.FirstOrDefault( a => a.Id == i ).Name
join c in db.Cs on b.C.Id equals c.Id
select new {
b.Id,
z = new { c.X, c.Y }
};
```

or

```
var q = from c in db.Bs
let i = c.As.FirstOrDefault().Id
let j = db.As.FirstOrDefault(a => a.Id == i).Name
let k = c.C
select new
{
c.Id,
z = new {k.X, k.Y}
};

```
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Feature: Improve reverse engineer when two tables with the same name in different schemas [268]

$
0
0
EF does not support multiple schemas in a database. All entities are created in a default namespace. This means entity name collisions could occur. Entity names are currently appended with a number to represent the next entity added to the model. This means that on systems with a large number of tables, the model must be edited by hand to properly resolve the name into an identifiable label.

A possible mitigation would be to ensure that each entity is placed in a namespace equivalent to the schema name.

SQL Server databases can contain multiple schemas. Each schema can have identically named table and function names. For example, ISVs are deciding to provide multi-tenant services. One mechanism is to provide a schema per customer and each schema would contain the same tables. But EF has not mechanism to enable such name clashes and provide automated name resolution. We are seeing this more and more particularly with customers planning to host their own service in the cloud but ensure they are utilizing the most cost effective measures to do so, ie. one SQL Server/multi-tenant.

Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Feature: Default sort order for entities [1684]

$
0
0
I imagine the implementation follows:

Fluent API:
modelBuilder.Entity<Customer>().Sorting(t => t.FirstName);
modelBuilder.Entity<Customer>().Sorting(t => new { t.FirstName, t.LastName });

Data Annotations:
[Sorting]
public string FirstName { get; set; }

or

[Sorting(1)]
public string FirstName { get; set; }

[Sorting(2)]
public string LastName { get; set; }

and in EF Designer as setting for properties

Thanks Marco
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Issue: TVFs don't work inside LINQ inline lamdas [204]

$
0
0
"this query works:

var q1 = from f in ctx.COrder1
from t in ctx.GetFoos(f.Oid)
select new { f, t };

but this doesn't:
var q2 = from f in ctx.COrder1
let test = ctx.GetFoos(f.Oid)
from t in test
select new { f, t };

throws Unhandled Exception: System.Data.EntityCommandCompilationException: An error occurred while preparing the command definition. See the inner exception for details. ---> System.NotSupportedException: The query attempted to call 'CrossApply' over a nested query, but 'CrossApply' did not have the appropriate keys.
at System.Data.Query.PlanCompiler.NestPullup.ApplyOpJoinOp(Op op, Node n)



CQT for q1:

Project
|_Input : 'LQ3'
| |_CrossApply
| |_Input : 'LQ1'
| | |_Scan : Container.COrder1
| |_Apply : 'LQ2'
| |_Store.Namespace.GetFoo(Edm.Int32 id)
| |_Arguments
| |_id
| |_Var(LQ1).Oid
|_Projection
|_NewInstance : Record['f'=FunctionV3.COrder, 't'=Record['B'=Edm.Int32]]
|_Column : 'f'
| |_Var(LQ3).LQ1
|_Column : 't'
|_Var(LQ3).LQ2



CQT for q2:

Project
|_Input : 'LQ4'
| |_CrossApply
| |_Input : 'LQ2'
| | |_Project
| | |_Input : 'LQ1'
| | | |_Scan : Container.COrder1
| | |_Projection
| | |_NewInstance : Record['f'=FunctionV3.COrder, 'test'=Collection{Record['B'=Edm.Int32]}]
| | |_Column : 'f'
| | | |_Var(LQ1)
| | |_Column : 'test'
| | |_Store.Namespace.GetFoo(Edm.Int32 id)
| | |_Arguments
| | |_id
| | |_Var(LQ1).Oid
| |_Apply : 'LQ3'
| |_Var(LQ2).test
|_Projection
|_NewInstance : Record['f'=FunctionV3.COrder, 't'=Record['B'=Edm.Int32]]
|_Column : 'f'
| |_Var(LQ4).LQ2.f
|_Column : 't'
|_Var(LQ4).LQ3"

This item was migrated from the DevDiv work item tracking system [ID=226867].

Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Issue: Multiple contexts, migrations and shared default schema [1685]

$
0
0
I have a multiple-contexts scenario that I assumed was a common usecase: two contexts that is sharing a default namespace via the modelBuilder.HasDefaultSchema. Every table in my contexts have overridden their schemas with per-context specific schemas, thus no tables are conflicting. The only thing they will share is the CommonSchema.__MigrationHistory table.

Now, scaffolding new migrations for both contexts work fine.

The first time I update the database with the first context, everything is created as expected, including the CommonSchema.__MigrationHistory table.

Next, when I try to update the database with the second context, the update operation fails with error:
SqlException (0x80131904): There is already an object named '__MigrationHistory' in the database.

Clearly, it doesn't "see" that the table is already there. My expectation was that this should just work fine, migration history for the two contexts should live happily together, separated by their ContextKey.

__Am I missing something here or is this a bug?__

__Update:__ trying out this scenario without using default schemas, thus migrations table ends up in the dbo namespace: __totally works__. Which strengthen my feeling that there is a bug with shared migration history and custom default schemas.
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Feature: Add proper support of multiple schemas in database. [1363]

$
0
0
Please add proper support of multiple schema database mapping.

The issue present itself when database have two or more schemas, with tables that have the same name.

Example:
Schema1.Content
Schema2.Content

In this case EF designer creates objects Content and Content1.

For time being I manually changing class names to something like SchemaName_TableName.

Please add automatic support of multiple schema databases. It would be really great to even have classes in different namspaces for different schemas.

Thanks
Eugene

Linking a related issue: https://entityframework.codeplex.com/workitem/268
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Feature: Migrations: Ability to 'Squash' Migrations [821]

$
0
0
After using EF Code First migrations for a while, I have reached a point where my production database is nice and stable. My code, however, has over a dozen migrations that are little more than historical relics.
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Feature: UpForGrabs: Allow using "Like" operator in LINQ [2388]

$
0
0
There is no way in EF to use Ms Sql "Like" operator, and I think its very important, "Patindex" and string.contains dosent not act as Like.
#I have a table with 16,000,000 records when I use Patindex in a query it takes about 40 sec and if I replace the Patindex with Like, it take just about 1 sec to execute. I cannot use contains too, I want to use use "%" and "_" in the middle of my string search pattern.
I have searched internet for hole one day, but no one knows how to use Like in EF, all experts recommended Patindex and contained function. I downloaded the source code of EF, I though there should a way to solve this simple problem and EF design should be very extensible but unfortunately when I looked at the source I see nothing can be changed all things are just hardcoded.
I found DbLikeExpression and SqlGenerator.Visit(DbLikeExpression e) methods, but I cannot create a derived class from SqlGenerator and override "ISqlFragment Visit(DbLikeExpression e)" method and Inject my new Sql Generator class to SqlProviderServices nor icannot add new DbExpression or override DbLikeExpression functionality.
I think EntityFramework.SqlServer project is an opensource project but there is no openness and extensibility in design, all class are declared as sealed or internal and there is loss usage of DI and no one can extend the functionality, at least in the way I want.
I should change the source code of the EF and use non standard version on my project.
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Unassigned: Migration take a long time and hang - vs 2013 update 4 ? [2713]

$
0
0
Hi

i try to enable Migration in my projects after update vs 2013 to update 4, but it take a long time and i must close my vs from task manager - and reopen it again for each task:

1. enable migration.

2. add migration.

3. update database.

** in update 3 there is no problem ?

** so please can anyone tell me what is the problem here ?
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Unassigned: SQL geography type "Not Supported" in function imports [2716]

$
0
0
I can use the EDM.Geography type for models in the EDMX file but if I try to import a function / stored procedure with a geography field then I get "Not Supported" as the "EDM Type" when clicking the "Get Column Information" button.
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**

Closed Unassigned: Entity Framework reads wrong values when working with UNION ALL / Concat and inner join [2715]

$
0
0
I'm using Entity Framework 6.1.3 and I'm getting the following an exception in case I `Concat` two sub queries, where the queries contain an inner join with other tables. This is the exception:

> System.InvalidOperationException : The specified cast from a materialized 'System.Int32' type to the 'System.Boolean' type is not valid.

With its stack trace:

```
at System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader'1.GetValue(DbDataReader reader, Int32 ordinal)
at lambda_method(Closure , Shaper )
at System.Data.Entity.Core.Common.Internal.Materialization.Coordinator'1.ReadNextElement(Shaper shaper)
at System.Data.Entity.Core.Common.Internal.Materialization.Shaper'1.SimpleEnumerator.MoveNext()
at System.Data.Entity.Internal.LazyEnumerator'1.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable'1 source)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable'1 query, Expression queryRoot)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable'1 source)
```

Here is my LINQ query:

``` C#
var a =
from asset in this.entities.Assets
select new AssetInboxItem
{
MappedToGard = true,
ResidualValue = new Money
{
Currency = new CurrencyInfo { Code = asset.Currency.Code }
},
};

var p =
from asset in this.entities.PreAssets
select new AssetInboxItem
{
MappedToGard = false,
ResidualValue = new Money
{
Currency = new CurrencyInfo { Code = asset.CurrencyCode }
},
};

var results = a.Concat(p).FirstOrDefault();
```

Here is the executed SQL query:

``` sql
SELECT TOP (1)
[c].[C1] AS [C1],
[c].[C2] AS [C2],
[c].[C3] AS [C3],
[c].[C4] AS [C4],
[c].[Code] AS [C5]
FROM (SELECT
1 AS [C1],
1 AS [C2],
1 AS [C3],
cast(1 as bit) AS [C4],
[Extent2].[Code] AS [Code]
FROM [dbo].[Asset] AS [Extent1]
INNER JOIN [dbo].[Currency] AS [Extent2] ON [Extent1].[CurrencyId] = [Extent2].[Id]
UNION ALL
SELECT
1 AS [C1],
1 AS [C2],
1 AS [C3],
cast(0 as bit) AS [C4],
[Extent3].[CurrencyCode] AS [CurrencyCode]
FROM [dbo].[PreAsset] AS [Extent3]) AS [c]
```

When I change the first LINQ query to the following:

``` c#
var a =
from asset in this.entities.Assets
select new AssetInboxItem
{
MappedToGard = true,
ResidualValue = new Money
{
Currency = new CurrencyInfo { Code = "EUR" }
},
};
```

I get a `NullReferenceException` originating from the `CTreeGenerator.VisitSetOp` method:

```
at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitSetOp(SetOp op, Node n, AliasGenerator alias, Func`3 setOpExpressionBuilder)
at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit(UnionAllOp op, Node n)
at System.Data.Entity.Core.Query.InternalTrees.UnionAllOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n)
at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n)
at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.Visit(ConstrainedSortOp op, Node n)
at System.Data.Entity.Core.Query.InternalTrees.ConstrainedSortOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n)
at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n)
at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.VisitAsRelOp(Node inputNode)
at System.Data.Entity.Core.Query.PlanCompiler.CTreeGenerator.BuildProjection(Node relOpNode, IEnumerable`1 projectionVars)
```

If I remove the assignments to the CurrencyCode.Code property, the query is executed successfully. Here's how the working code looks like:

``` C#
var a =
from asset in this.entities.Assets
select new AssetInboxItem
{
MappedToGard = true,
ResidualValue = new Money
{
Currency = new CurrencyInfo { }
},
};

var p =
from asset in this.entities.PreAssets
select new AssetInboxItem
{
MappedToGard = false,
ResidualValue = new Money
{
Currency = new CurrencyInfo { }
},
};

var results = a.Concat(p).FirstOrDefault();
```

And this is the executed SQL query:

``` sql
SELECT TOP (1)
[c].[C1] AS [C1],
[c].[C2] AS [C2],
[c].[C3] AS [C3],
[c].[C4] AS [C4],
[c].[C5] AS [C5]
FROM (SELECT
1 AS [C1],
cast(1 as bit) AS [C2],
1 AS [C3],
1 AS [C4],
cast(1 as bit) AS [C5]
FROM [dbo].[Asset] AS [Extent1]
UNION ALL
SELECT
1 AS [C1],
cast(0 as bit) AS [C2],
1 AS [C3],
1 AS [C4],
cast(1 as bit) AS [C5]
FROM [dbo].[PreAsset] AS [Extent2]) AS [c]
```

I think I spotted 2 bugs here. I hope you can fix this in a patch release.
Comments: **EF Team Triage:** We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base. Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). **Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).** This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include: * It was a bug report that does not contain sufficient information for us to be able to reproduce it * It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it * It is a feature request that we are realistically not going to implement on the EF6.x code base Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). **We will no longer be monitoring this issue tracker for comments, so please do not reply here.**
Viewing all 10318 articles
Browse latest View live




Latest Images