Entity Framework Feature Suggestions
Welcome! You can use this site to tell the Entity Framework team what features you want to see in future versions.
Remember that this site is only for feature suggestions and ideas!
If you have technical questions or need help with EF try StackOverflow or visit our forums.
If you want to report a bug you found in EF use the Entity Framework project page on CodePlex.
If you want to find more information about the Entity Framework go to our MSDN site.
-
Improved SQL Generation
I have seen simple select statements with 4 or 5 includes result in nearly 5000 line SQL statements when an equivalent hand-written SQL statement is ~15 lines. The performance of these queries along with the readability when debugging makes it an area that I would like to see the EF team focus on improving.
2,069 votesThe update for the core EF libraries that will be included in .NET 4.5 will include some improvements in SQL generation. However not all the scenarios mentioned in the comments will be addressed.
I am going to leave this idea as open for now, until we figure out a better way to track individual scenarios, which we need to do to get more actionable data.
-
Unique Constraint (i.e.Candidate Key) Support
SQL Server and other databases support Unique Constraints on tables. Foreign key constraints are generally based on unique constrains on the principal side, with the Primary Key being only a special case of a unique constraint.
The Entity Framework currently only supports basing referential constraints on primary keys and does not have a notion of a unique constraint. The idea is to have:• Support for specifying a unique constraint on an Entity
• Support for specifying a foreign key associations that on the principal end specify columns(s) that comprise a unique constraint but are not the primary key,1,447 votes -
Support for multiple databases
Like to be able to build a domain model over data in multiple databases. With out having to manage database objects - linked servers, views etc.
1,153 votes -
IndexAttribute
Create a IndexAttribute for annotating entities with index hints for the Database.
For Example[Index(Direction.Ascending)]
string MyProptery{Get;set;}948 votes -
Support for simple type mapping or mapped type conversions
Currently the only conversion available in EF Core libraries 4.5 and EF 5.0 are enums mapped to integers but that is only tip of the iceberg. There is whole big feature behind - simple type mapping or conversions defined directly in mapping.
For example what if my database contains char column with Y, N values and I want to map it to bool property directly without any additional stuff doing the conversion inside my entity? Or more complex example - what if my column contains value like en-us and I want to map it to instance of CultureInfo? There are…
725 votes -
XML data type support
EF4 full support of XML field
403 votes -
Better support for Self-Tracking Entities
The current implementation of self-tracking entities is error-prone especially when combined with disconnected scenarios, such as, when using WCF services. The reconciliation process with the ObjectStateManager is convoluted and makes it easy to trip up when saving larger aggregates with Self-Tracking Entities. I would like to see more effort put in to improve the Self-Tracking Entities template and to improve how EF and Self-Tracking Entities interact.
323 votes -
Support for other native data types and user defined types
Well it has to be in the .NET Framework data types, not sure whether there would be any work to do in EF for this. Meanwhile there should be a provision to include the new data types in the backend. for e.g. Oracle can have it's own user defined types, SQLServer 2008 R2 has HierarchyID datat type which I am not sure to what datatype it would map to at the conceptual level
We should have provision for such types
272 votes -
Code First support for Stored Procedures
EF 4.1 doesn't support stored procedures in code-first:
http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-release-candidate-available.aspx
262 votes -
Customize mapping for stored procedure
So far a stored procedure cannot be mapped to an entity with complex properties. Well it can be mapped, but the execution fails at runtime. It would be great if we could map stored procedure columns to entity properties.
260 votes -
Decouple entity creation in EF and support entities without default constructors and publically settable properties
EF should decouple the implementation of the entity objects from the mapping functionalities. The EF team could provide the current entity creation as a default variant which can be attached to the mapper. The developer has the option to provide it's own data transfer object layer. Therefore we need to abstract the entities through interface usage an a generic naming schema (dot notation of an object model like Person.Name). So the EF would be much more flexible to use.
Note by Diego Vega: I am merging this idea with a few other ideas that are approximately equivalent but extend in…
211 votes -
194 votes
-
Delete orphan records
Entity Framework should support automatic deletion of orphan records, the way "all-delete-orphan" works in NHibernate.
If I have a one-to-many relationship between Orders and OrderLines, and code inside the Order class calls OrderLines.Remove(orderLine), this should cause the order line to be deleted when I save changes. Currently, EF attempts to set the order line's OrderID to NULL. If the OrderID column is non-nullable, the update fails with a constraint violation error.
I found this forum post in which Daniel Simmons from Microsoft says EF doesn't support this: http://social.msdn.microsoft.com/forums/en-us/adodotnetentityframework/thread/CB9C1C4A-DF12-44E4-B00A-417C80BF5453
This is an important feature for an ORM, since it's difficult to…
167 votes -
Bring back CompiledQuery in Code First
CTP 5 dropped compiled query support, this is a huge mistake. Please make sure it is there in the final product.
167 votes -
Extra Lazy-Loading
When I do user.Cars.Add() EF load all Cars for that user.
user.Cars.Count() too146 votes -
Code First support for Table-Valued Functions
The EF team has marked the previous TVF feature suggestion as Completed saying TVF support will be included with .NET 4.5. It had 226 votes at the time. However, this excludes Code First support. Vote for this suggestion to specifically add Code First support for TVFs.
133 votes -
Ability to specify NoLock and other query hints
Table lock, update lock ( WITH(UPDLOCK) / FOR UPDATE ).
LockMode something like NHibernate.Also should support controlling parameter sniffing
126 votes -
Make Entity Framework Fully Mockable and injectable In general, mocking out the Entity Framework DAL is a big pain to accomplish. ObjectCon
Make Entity Framework Fully Mockable and injectable
In general, mocking out the Entity Framework DAL is a big pain to accomplish. ObjectContext has no interface and the T4 templates aren't written to create interfaces for the objects they create.
This hampers good unit testing and makes them less injectable.
Put an interface on ObjectContext. Have the T4 Templates put interfaces around all of the objects that are generated and make sure that all objects used have interfaces so that mocking frameworks, like MOQ or Moles & Pex can automatically generate stubs to replace the objects in unit tests so that…
125 votes -
Take namespaces into account for POCOs mappings
This is a must for modularity. We already support this feature on our side with schemas (sql server) the only problem is EF does not take namespaces into account.
120 votes -
Simple Static Delete and Update Methods
Allow for simple delete and update operations that do not require multiple round trips to the database. They could be static methods on each Entity. For example:
Cars.Delete(int ID)
or
Cars.Delete(Guid ID)This would delete a car record with the associated ID if it exists. The code generation template should be smart enough to create the static methods using the correct data type.
For updates you would pass in the ID and a set of named parameters for the fields that need to be updated:
Car.Update(10, {Status="Sold", ModifiedDate=DateTime.Now}
I think people are doing this now using functions or executing SQL
95 votes
- Don't see your idea?