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

Commented Issue: Can't map two classes with same name from different namespace [483]

$
0
0
EF doesn't allow two classes with the same name, but different namespaces, to be mapped.

This is complex to change so we also have an item to provide a better exception message until this is supported - http://entityframework.codeplex.com/workitem/589

namespace Test.Security
{
public class Question
{
public Guid Id { get; set; }
}
}

namespace Test.Forms
{
public class Question
{
public Guid Id { get; set; }
}
}

Comments: I can't believe this bug has been unfixed for so long. I'm working on a conversion project where 6-10 databases being converted are going to have the same table names. I have been using database first without issues until I just now ran into the first database that has duplicate table names. This should really have a higher priority and get fixed, it's pretty sad that a bug of this magnitude can go unfixed for 4-5 years...

Commented Unassigned: FunctionParameter.Create and TypeUsage facets [2795]

$
0
0
The public API for creating a FunctionParameter object only permits passing an EdmType instance. Internally it uses that EdmType to create a default TypeUsage with no facets. That makes it impossible to specify specific facets for a parameter. With MS SQL Server all String parameters end up being NVARCHAR(4000).

Under some circumstances passing an incorrect parameter to a user-defined function can cause an error in MS SQL Server. For example, if a tabular user-defined function is defined as follows:

```
CREATE FUNCTION dbo.FindCustomers (@terms VARCHAR(1000))
RETURNS TABLE
AS RETURN (
SELECT *
FROM dbo.Customers
WHERE CONTAINS(*, @terms)
);
```

If this function is passed an NVARCHAR(4000) the database will raise an error with the message, "The full-text query parameter for Fulltext Query String is not valid."

Is there a reason why FunctionParameter.Create does not permit specifying the facets for the TypeUsage of the parameter? Or even passing an existing TypeUsage rather than creating a new one from the specified EdmType?
Comments: So I decided to break out the reflection and manually call the internal ctor of FunctionParameter to force the TypeUsage representing a varchar(1000). I can confirm that the facets are correct in the metadata and that the helper properties of FunctionParameter report the type as I would expect. However, when the query is generated for MSSQL the facets appear to be ignored and the parameter type is still NVARCHAR(4000). Is explicitly setting the parameter types like this supported?

Commented Unassigned: FunctionParameter.Create and TypeUsage facets [2795]

$
0
0
The public API for creating a FunctionParameter object only permits passing an EdmType instance. Internally it uses that EdmType to create a default TypeUsage with no facets. That makes it impossible to specify specific facets for a parameter. With MS SQL Server all String parameters end up being NVARCHAR(4000).

Under some circumstances passing an incorrect parameter to a user-defined function can cause an error in MS SQL Server. For example, if a tabular user-defined function is defined as follows:

```
CREATE FUNCTION dbo.FindCustomers (@terms VARCHAR(1000))
RETURNS TABLE
AS RETURN (
SELECT *
FROM dbo.Customers
WHERE CONTAINS(*, @terms)
);
```

If this function is passed an NVARCHAR(4000) the database will raise an error with the message, "The full-text query parameter for Fulltext Query String is not valid."

Is there a reason why FunctionParameter.Create does not permit specifying the facets for the TypeUsage of the parameter? Or even passing an existing TypeUsage rather than creating a new one from the specified EdmType?
Comments: Interesting, it appears that unless the root DbCommandTree is a DbFunctionCommandTree that the CreateCommand method of SqlProviderServices just uses the conceptual type of the parameter, Edm.String. Without the type usage and facet information that would map to NVARCHAR(4000) by default. This seems like a heckuva limitation. Would I be barking up the wrong tree to attempt to navigate the tree to find out where a particular parameter might be bound in order to correlate the parameters to a specific EdmFunction and FunctionParameter? I don't know if enough information is known to be able to correlate the two at this point.

Created Unassigned: Attribute uniqueidentifier PK with ROWGUIDCOL [2796]

$
0
0
Hello!

If the PK is of type ROWGUIDCOL it should be attributed with ROWGUIDCOL in the synthesized SQL code.


Best regards,

Henrik Dahl

Created Unassigned: Make the PK constraint NONCLUSTERED when explicit clustering is specified for another property using the IndexAttribute [2797]

$
0
0
Hello!

Make the PK constraint NONCLUSTERED when explicit clustering is specified for another property using the IndexAttribute.


Best regards,

Henrik Dahl

Commented Issue: Can't map two classes with same name from different namespace [483]

$
0
0
EF doesn't allow two classes with the same name, but different namespaces, to be mapped.

This is complex to change so we also have an item to provide a better exception message until this is supported - http://entityframework.codeplex.com/workitem/589

namespace Test.Security
{
public class Question
{
public Guid Id { get; set; }
}
}

namespace Test.Forms
{
public class Question
{
public Guid Id { get; set; }
}
}

Comments: Very sad to see this issue being ignored. between CF and EF7 not supporting generating stored procs and this issue you're really putting your users in a tough spot. You recommend using EF 6 and claim that it will be supported even after EF7 but those words ring pretty hollow when seeing something like this.

Commented Unassigned: System.Data.Entity Dependant on Microsoft.Office.Interop.Word and Microsoft.DirectX.DirectSound [2793]

$
0
0
I developed an application using framework 3.5 and my application fails if Microsoft.Office.Interop.Word.dll or Microsoft.DirectX.DirectSound.dll were not found.

Fuslog shows that the calling assembly for those dlls is System.Data.Entity as below:

*** Assembly Binder Log Entry (8/6/2015 @ 11:35:19 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable d:\build\Pacs_Integ\bin\release\MedStreaming.Client.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = WIN-8CA5GMGURLD\Administrator
LOG: DisplayName = Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///d:/build/Pacs_Integ/bin/release/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: Start binding of native image Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
WRN: No matching native image found.

I tried to create another simple project that uses Sytem.Data.Entity.dll and it did not call these dlls, I cannot find why these dlls called by my application!

Is there a way to decouple my application from these dlls?
Comments: Hey, There are some cases where EF will scan assemblies to locate entity types for your model. Do you have these assemblies referenced? Not sure if it is possible to post the project so that we can take a look? ~Rowan

Created Unassigned: 6.1.3 Inheritance Bug (6.1.1 works fine) [2798]

$
0
0
With this model

public class Class1
{
[Key]
public int Id { get; set; }

public virtual string MyProperty { get; set; }
// other properties
}

public class Class3 : Class1
{
[Required]
public override string MyProperty { get; set; }

public string Class3Prop { get; set; }
}


public class TestContext : DbContext
{
public TestContext(DbConnection connection) : base(connection, true) { }

public DbSet<Class1> C1s { get; set; }
public DbSet<Class3> C3s { get; set; }


}

I expect that Class3.MyProperty is required and Class1.MyProperty is not required.

With EF 6.1.1 everything's working fine (in SQL Server the MyProperty field is nullable).
With EF 6.1.3 both Class3.MyProperty and Class1.MyProperty are interpreted as Required (and in SQL Server MyProperty field is not nullable)


Edited Unassigned: FunctionParameter.Create and TypeUsage facets [2795]

$
0
0
The public API for creating a FunctionParameter object only permits passing an EdmType instance. Internally it uses that EdmType to create a default TypeUsage with no facets. That makes it impossible to specify specific facets for a parameter. With MS SQL Server all String parameters end up being NVARCHAR(4000).

Under some circumstances passing an incorrect parameter to a user-defined function can cause an error in MS SQL Server. For example, if a tabular user-defined function is defined as follows:

```
CREATE FUNCTION dbo.FindCustomers (@terms VARCHAR(1000))
RETURNS TABLE
AS RETURN (
SELECT *
FROM dbo.Customers
WHERE CONTAINS(*, @terms)
);
```

If this function is passed an NVARCHAR(4000) the database will raise an error with the message, "The full-text query parameter for Fulltext Query String is not valid."

Is there a reason why FunctionParameter.Create does not permit specifying the facets for the TypeUsage of the parameter? Or even passing an existing TypeUsage rather than creating a new one from the specified EdmType?

Created Unassigned: Allow generating migration code for a custom MigrationOperation from CSharpMigrationCodeGenerator [2799]

$
0
0
Currently, the CSharpMigrationCodeGenerator must have a specific Generate method for each specific MigrationOperation in the migration. If there is a custom MigrationOperation in the list of migrations, it falls back to the Generate method for the AddColumnOperation, which fails with the following exception:

_The best overloaded method match for 'System.Data.Entity.Migrations.Design.CSharpMigrationCodeGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter)' has some invalid arguments_

The CSharpMigrationCodeGenerator should work more like the SqlServerMigrationSqlGenerator, where there is a virtual Generate method for MigrationOperation:
```
protected virtual void Generate(MigrationOperation migrationOperation)

```
As:
```
protected virtual void Generate(MigrationOperation migrationOperation, IndentedTextWriter writer)

```
In this way, developers could override this virtual method when creating a class that derives from CSharpMigrationCodeGenerator the same way it is currently possible with the SqlServerMigrationSqlGenerator class.

Without this, the workaround is to either reimplement the CSharpMigrationCodeGenerator or skip the code migration step for custom migration operations and translate each into a SqlOperation.

As a side note, since there is already a GetDefaultNamespaces virtual method, we can register any custom namespaces required to support the custom MigrationOperation types, so there is no issue with the migration class being generated with broken references.

- Travis Schettler

Edited Unassigned: Allow generating migration code for a custom MigrationOperation from CSharpMigrationCodeGenerator [2799]

$
0
0
Currently, the CSharpMigrationCodeGenerator must have a specific Generate method for each specific MigrationOperation in the migration. If there is a custom MigrationOperation in the list of migrations, it falls back to the Generate method for the AddColumnOperation, which fails with the following exception:

_The best overloaded method match for 'System.Data.Entity.Migrations.Design.CSharpMigrationCodeGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter)' has some invalid arguments_

The CSharpMigrationCodeGenerator should work more like the SqlServerMigrationSqlGenerator, where there is a virtual Generate method for MigrationOperation:
```
protected virtual void Generate(MigrationOperation migrationOperation)

```
As:
```
protected virtual void Generate(MigrationOperation migrationOperation, IndentedTextWriter writer)

```
In this way, developers could override this virtual method when creating a class that derives from CSharpMigrationCodeGenerator the same way it is currently possible with the SqlServerMigrationSqlGenerator class.

Without this, the workaround is to either reimplement the CSharpMigrationCodeGenerator or skip the code migration step for custom migration operations and translate each into a SqlOperation.

As a side note, since there is already a GetDefaultNamespaces virtual method, we can register any custom namespaces required to support the custom MigrationOperation types, so there is no issue with the migration class being generated with broken references.

-- Travis Schettler

Commented Unassigned: Getting the column name (SSpace) from a CLR property name is not possible [2779]

$
0
0
I can see from the following example how to get the table name of an OSpace type:

https://lowrymedia.com/2014/06/10/ef6-1-mapping-between-types-tables-including-derived-types/

But how do I go about getting the SSpace column name from an OSpace property name (i.e. CLR type property)?

By browsing the MetadataProperties from the corresponding CSpace property, I can see there is a "Configuration" entry containing the column name if changed using the Fluid API or ColumnAttribute, but the value of the entry is an internal class on EF's part.

I am then inclined to say that it is not possible to get column name, taking into account the Fluid APi, at this point, without using reflection on EF's internal class.
Comments: Thank you RoMiller! :)

Closed Unassigned: Make the PK constraint NONCLUSTERED when explicit clustering is specified for another property using the IndexAttribute [2797]

$
0
0
Hello!

Make the PK constraint NONCLUSTERED when explicit clustering is specified for another property using the IndexAttribute.


Best regards,

Henrik Dahl

Comments: Dupe of https://entityframework.codeplex.com/workitem/2163

Commented Unassigned: Attribute uniqueidentifier PK with ROWGUIDCOL [2796]

$
0
0
Hello!

If the PK is of type ROWGUIDCOL it should be attributed with ROWGUIDCOL in the synthesized SQL code.


Best regards,

Henrik Dahl

Comments: Hey Henrik, Could you provide some more detail on this one for us to help us understand the scenario? What you want your classes to look like, what the database looks like, and how you want EF to behave. We weren't sure if you meant that you wanted the PK to be able to change values (which is not supported by EF). ~Rowan

Edited Unassigned: IEnumerable null values return the last not-null value [2800]

$
0
0
I created view on sql server 2014 that will return null values for some records.

when I tried to get .ToList() or ToArray() for this view.. the null values filled with the last not-null values


Created Unassigned: EF 6.1.3 is VERY slow [2801]

$
0
0
EF 6.1.3 has some __serious__ performance issues. Even a simple query is many times slower than for example in EF 4.1. Only setting context.Configuration.AutoDetectChangesEnabled = false is helping in some cases but this shouldn't be the permanent solution.

Commented Feature: Designer: Better navigation property names when multiple relationships to the same table [125]

$
0
0
When multiple relationships to the same table are present the navigation properties are just postfixed with a name. We could consider using the FK name or some other means to make it clearer which is which.

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

This work item originated from connect.microsoft.com. A member of the EF team at Microsoft should close the related Connect issue when closing this work item.

Comments: one possible workaround could be to parse the .edmx file using an external tool and replace all texts starting with ``` <NavigationProperty Name= ``` we have all needed information in one or two lines in the .edmx file (multiplicity, FK name, etc). Easy to parse.

Created Unassigned: IEnumerable projections are assigned a list and then the list mutated [2802]

$
0
0
Consider the following classes:

public class Test {

public IEnumerable<Container> Fake {
get {
return Real.Select(e => new Container { Item1 = e.Item1 });
}
set {
Real = new List<Tuple<int>>(value.Select(p => new Tuple<int>(p.Item1)));
}
}

public List<Tuple<int>> Real { get; set; }
}

public class Container {
public int Item1 { get; set; }
}

And the following query:

from a in Something
group a by a.Field into g
select new Test {
Fake = g.Select(a => new Container { Item1 = a.Id })
}

The result is a quite surprising empty `Fake` and `Real` Properties. Stepping in the debugger suggests that EF assigns a list to Fake, and then tries to add elements to that reference, which of course fails in this setting.

The same query works when executed over Linq to Sql.

EF should populate the list and then assign it. It should not assume the stored object will persist.

Closed Unassigned: Allow generating migration code for a custom MigrationOperation from CSharpMigrationCodeGenerator [2799]

$
0
0
Currently, the CSharpMigrationCodeGenerator must have a specific Generate method for each specific MigrationOperation in the migration. If there is a custom MigrationOperation in the list of migrations, it falls back to the Generate method for the AddColumnOperation, which fails with the following exception:

_The best overloaded method match for 'System.Data.Entity.Migrations.Design.CSharpMigrationCodeGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter)' has some invalid arguments_

The CSharpMigrationCodeGenerator should work more like the SqlServerMigrationSqlGenerator, where there is a virtual Generate method for MigrationOperation:
```
protected virtual void Generate(MigrationOperation migrationOperation)

```
As:
```
protected virtual void Generate(MigrationOperation migrationOperation, IndentedTextWriter writer)

```
In this way, developers could override this virtual method when creating a class that derives from CSharpMigrationCodeGenerator the same way it is currently possible with the SqlServerMigrationSqlGenerator class.

Without this, the workaround is to either reimplement the CSharpMigrationCodeGenerator or skip the code migration step for custom migration operations and translate each into a SqlOperation.

As a side note, since there is already a GetDefaultNamespaces virtual method, we can register any custom namespaces required to support the custom MigrationOperation types, so there is no issue with the migration class being generated with broken references.

-- Travis Schettler
Comments: You can override the `Generate(MigrationOperation migrationOperation)` method to handle your custom operation. This blog post walks thru how to handle custom operations http://romiller.com/2013/02/27/ef6-writing-your-own-code-first-migration-operations/.

Reopened Unassigned: Allow generating migration code for a custom MigrationOperation from CSharpMigrationCodeGenerator [2799]

$
0
0
Currently, the CSharpMigrationCodeGenerator must have a specific Generate method for each specific MigrationOperation in the migration. If there is a custom MigrationOperation in the list of migrations, it falls back to the Generate method for the AddColumnOperation, which fails with the following exception:

_The best overloaded method match for 'System.Data.Entity.Migrations.Design.CSharpMigrationCodeGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation, System.Data.Entity.Migrations.Utilities.IndentedTextWriter)' has some invalid arguments_

The CSharpMigrationCodeGenerator should work more like the SqlServerMigrationSqlGenerator, where there is a virtual Generate method for MigrationOperation:
```
protected virtual void Generate(MigrationOperation migrationOperation)

```
As:
```
protected virtual void Generate(MigrationOperation migrationOperation, IndentedTextWriter writer)

```
In this way, developers could override this virtual method when creating a class that derives from CSharpMigrationCodeGenerator the same way it is currently possible with the SqlServerMigrationSqlGenerator class.

Without this, the workaround is to either reimplement the CSharpMigrationCodeGenerator or skip the code migration step for custom migration operations and translate each into a SqlOperation.

As a side note, since there is already a GetDefaultNamespaces virtual method, we can register any custom namespaces required to support the custom MigrationOperation types, so there is no issue with the migration class being generated with broken references.

-- Travis Schettler
Viewing all 9566 articles
Browse latest View live


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