I can't always get the best performance for extremely specific queries queries in Entity Framework. Sometimes it is best to just write very specific SQL (Currently working on a CTE recursive query that I wouldn't even know how to begin getting into EF without hitting the DB multiple times). Having SqlQuery<T> available give me complete freedom and allows me to use EF in the same way as Micro ORMS like Dapper to map a specific DTO when it makes sense. I don't wan't to have to map a custom object to my context and use the FromSql implementation off of a DbSet. I will probably end up just building my own extensions to solve this for now, but this always felt like a fundamental part of EF that allowed freedom on an as needed/when it makes sense basis.
I can't always get the best performance for extremely specific queries queries in Entity Framework. Sometimes it is best to just write very specific SQL (Currently working on a CTE recursive query that I wouldn't even know how to begin getting into EF without hitting the DB multiple times). Having SqlQuery<T> available give me complete freedom and allows me to use EF in the same way as Micro ORMS like Dapper to map a specific DTO when it makes sense. I don't wan't to have to map a custom object to my context and use the FromSql implementation off of…83 votes
Ad-hoc mapping for non-model types for raw SQL queries is tracked by https://github.com/aspnet/EntityFramework/issues/1862, currently planned for EF Core 1.1.
Other related features in the backlog:
Allow passing CTEs as preamble argument in FromSql() https://github.com/aspnet/EntityFramework/issues/4976
Support for CTEs https://github.com/aspnet/EntityFramework/issues/2865
want to use the entity framework. However I also have the requirement of allowing my users to define custom fields in our system. I would like to still use the entity framework and not use a a partial class with a hash table property.80 votes
please add SQL Server 2012 features to new release of entity framework and code first that support filestream and filetable70 votes
When generating from database, the EDMX designer should generate XML Documentation (Summary field) from the SQL Description field of each table/column etc.68 votes
For example a database table could have a [Settings] column of type xml. And a mapped entity type could have a property [Settings] of some serializable type. Then you will be able to read and write data into and from this [Settings] column with EF. Like this:
var user = db.Users.First(x => x.ID == 1);
if (user.Settings == null)
user = new Settings();
user.Settings.ProductsPerPage = 20;
Say there is one database shared by several applications, objects are separated by schema. So it would be nice to be able to store and apply migrations for one schema independently from another one.60 votes
When we originally marked this issue as completed we did not take into consideration the ability to ignore certain tables in migrations for overlapping models.
This is still not supported in EF Core (or in EF6)
So far a stored procedure can return only a plain entity. It would be great if we could create a stored procedure that returns orders and details information in a single roundtrip.54 votes
I have a LINQ query that involves a nullable integer. When I try to run the query, I get the following error:
"LINQ to Entities does not recognize the method 'Int32 GetValueOrDefault(Int32)' method, and this method cannot be translated into a store expression."
I am not a L2E or EF guru in the least, but it seems like that should translate to the SQL ISNULL function shouldn't it?
Regardless, can you please make this functionality work?45 votes
EF should have some better data change tracking/auditing plumbing...on par with the extensive trace listener class support in ASP.NET. In order to create an audit history of the CRUD actions taking place within my entity model in EF 4.0, I had to write a lot of custom code and override the SavingChanges event and the OnContextCreated method to make it happen. Even now it doesn't properly catch all actions due to certain limitations (such as having DB-set identity fields). Think about how to make auditing data changes simpler and richer for devs!38 votes
I would like to see the T-SQL MERGE statement supported. For multi threading situations it really would be useful.38 votes
Currently if an empty set is expected it is necessary to cast either the result or the input elements of Sum to Nullable<T> to compensate for the type mismatch between the SQL database and the signature of the methods in LINQ.38 votes
Some customers want to write queries that include such expressions as "date1 - date2" or "datetime3 + timespan1 > datetime4". LINQ to Entities currently support some of date/time operations through the EntityFunctions.AddX and DiffX functions, but it doesn't support built-in operators with data/time types.37 votes
ADO.Net supports bulk insert for big amount of data. With the help of this library
It is possible to do Bulk inserts with entities. But it would be nice if there would be a integrated approach.31 votes
Should be able to SaveChanges of certain entities while leaving the other entities in Added etc. mode, this is useful when you want to save data in a page that some other parts of the page contain invalid data that can't be saved.26 votes
It would be great to be able to do an "update-database" without having to execute the seeding commands as well. We are seeding quite a lot of meta data into our system, and it is a waste of time to wait for seeding each time we update/manipulate our model.
A flag in command prompt like
would suffice.26 votes
There should be to each Linq to Entities query an extension "Exclude" that returns IEnumerable<TSource> and the excluded fields will not be selected from the store/source.26 votes
The F# SqlEntityConnection Type Provider is a third way to interact with Entity framework (with the other two being an .edmx file and Code First).
This Type Provider doesn't support the updated low-level API changes that EF 6 requires, as far as I can tell. I'd love to have an updated version that supports the async features of EF 6.22 votes
I get so frustrated by the referential integrity constraint violation and the fact that the exception thrown contains no information about which fields are causing the problem.
Here's the full message for reference:
"A referential integrity constraint violation occurred: The property values that define the referential constraints are not consistent between principal and dependent objects in the relationship."
Could you please update this exception to provide some key information so that we can track this issue down?
Allow mapping of database views without requiring the Key Attribute
When mapping entitis to Views, it´s common that no Key can be set, bescause the view does not provide it and you can´t map it. The idea is:
* Make it possible to map to Views (or tables) in a read only fashion that does not require the Key Attribute20 votes
- Don't see your idea?