Entity Framework Core Feature Suggestions

Welcome! Use this web site to submit ideas and vote for what features you want to see in future versions of Entity Framework Core.

Our team will only fix bugs, implement small improvements and accept community contributions in the EF6 codebase. Larger feature work and innovation will happen only in the EF Core codebase. If you have ideas for improving EF6, we recommend you submit them on the EF6 GitHub site listed below.

Please also consider these other options before submitting anything to this site:

  • If you want to learn how to use our products, visit our documentation pages.
  • If you want to report bugs, make contributions, or learn about our product roadmaps, visit our EF Core or EF6 project pages on GitHub.
  • If you have technical questions or need help, try StackOverflow’s EF Core or EF6 tags, or visit our MSDN forums. Note that roadmap questions, bug reports, feature requests or ideas are not appropriate for StackOverflow. Visit StackOverflow’s help center for guidance on appropriate usage.

How can we improve Entity Framework Core?

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  1. Query serialization / deserialization

    ** SUGGESTION **
    Native support for query serialization and deserialization (to XML) decoupled from a concrete ObjectContext, including query parametrization and correct management of lambda expressions (e.g. using expression expansion as in LinqKit).

    ** WHY **
    We've developed a set of classes that allow a query to be written in the client layer and executed in the service layer via web services (with POCO entities). After the query is written normally using linq to entities and obtaining an IQueryable<T> object, this implementation transparently does the following:

    CLIENT side:
    - Expands the query expression tree to correctly manage lambda expressions.
    -…

    10 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
    • System.Data.Entity.DbSet<TEntity>.Create() method overload for taking n parameters

      The idea would be to overload Create() method on DbSet so as to take any parameters, resolving to the constructor tha best fits, like so

      public TEntity Create(params object[] args);

      (I understand the generated proxy for change tracking and nivigational properties support should honor all constructors defined on the TEntity type)

      This would allow for a much cleaner (and layarable) DomainModel. Entities may now be created from required values and the need to set those values (i.e. the need for public setters) after the creation dissapears.

      10 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
      • Define RelatedProperty on an inherited foreign key

        Allow mapping to entity in a derived class based on a property in base class.

        Normally, we create a [RelatedTo] property for a foreign key defined in the same class.

        But it would be quite handy to be able to define [RelatedTo] on a Foreign Key defined in the base class.

        10 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
        • Support optional complex type

          For example: Class Foo has a property named Bar and that property is a reference to the complex type ComplexBar. It would be great if Bar could be left null in cases when a "user/whatever" does not have any ComplexBar information. The benefit is that ComplexBar can have required properties and other validation that only applies when the property Bar is not null. If it is null then that validation is not triggered because it does not apply. If I want Bar to always have a value then I can flag it as required, and it will behave like complex…

          9 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            1 comment  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
          • Change schema for DbContext per connection

            Build one model from code first and then use new TennantContext(connection, schema).

            Exactly as HasDefaultSchema but possible to change with new connection.

            No migrations and no other special features needed.

            Lets say I have users data stored in one DB but in different schemas (each user has own schema). I have 1000+ of users, every model for every user is cached by IDbModelCacheKeyProvider is RAM kill.

            P.S. Alter user set default schema is not a solution

            Thanks

            9 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
            • Navigation properties in composite ids without need for the corresponding scalar property

              If you have a class like

              public class CustomerAddress
              {
              public virtual Customer Customer { get; set; }
              public virtual Address Address { get; set; }
              public virtual string AddressType { get; set; }
              public virtual DateTime ModifiedDate { get; set; }
              }

              you should be able to create a composite id like this

              HasKey(a => new { a.Customer, a.Address });

              without defining CustomerId and AddressId properties

              9 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
              • 9 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  1 comment  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                • Support Pessimistic Concurrency

                  Allow a Select with UpdLock which locks all returned entities in the Database. This is a basic requirement to program for example a ticket sales portal with entity framework! So far it's not possible and I still have to stick to NHibernate :(

                  8 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                  • Allow adding fluent code to each entity, to minimize the mess in the context

                    There should be a way (perhaps by implementing an interface), to add fluent code separately to each entity instead of adding it all in the OnModelCreating method.
                    The OnModelCreating base method should call all the entities that implement that interface and call OnModelCreating(context) of it.
                    In this way the bunch of fluent code in the main context, especially if it's a large one, would tidy up in the individual entities.
                    Of course, this is already simply doable, but I think this should go out the box.

                    8 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      I agree to the terms of service
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      1 comment  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                    • Support for .Contains(Entity)

                      Be able to write code like "if (Context.Table.Contains(entity))"

                      8 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        I agree to the terms of service
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        3 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                      • Improved API for Migrations

                        The API for DbMigrator is lacking. I would like to see .UpOne(), .DownOne(), .Up(n), .Down(n) methods to attempt to perform that number of migrations.

                        .Update("0") is an odd-looking way to completely thrash the DB. Something like .RollbackAll() would be a very simple implementation and have a much clearer name.

                        Having .Update() take an additional optional parameter to completely rollback first, and apply all migrations from scratch might be very nice, especially in a test or development environment.

                        Generating an SQL script for logging purposes and then performing the DB migration must currently (I believe) be done in two steps. A…

                        7 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          I agree to the terms of service
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          1 comment  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                        • Allow inserting new entities with predefined identity column values (INSERT_IDENTITY)

                          Especially for migration projects it would be useful to allow entities to be saved with predefined identity values.

                          Until now you have to use ADO.NET to do this.
                          SET IDENTITY_INSERT TableName ON
                          INSERT INTO TableName (IdColumn, Column1)
                          VALUES (234, 'Value')

                          I would like to tell the DbContext to use this feature when saving new entities.

                          7 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            I agree to the terms of service
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                          • Support for multiple result sets in .ExecuteFunction() and .ExecuteQuery()

                            public Tuple‹T1, T2› ExecuteQuery‹T1, T2›(string query) { ... }
                            public Tuple‹T1, T2, T3› ExecuteQuery‹T1, T2, T3›(string query) { ... }

                            7 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              I agree to the terms of service
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              1 comment  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                            • Allow foreign key columns to be shared between a subset of TPH subclasses

                              Scenario in the post http://entityframework.codeplex.com/workitem/583 works only for columns that are not foreign keys.

                              For example we have BaseEntity and three inherited entities:
                              InheritedEntity1.Name
                              InheritedEntity2.SpecialStatus
                              InheritedEntity3.SpecialStatus

                              SpecialStatus is entity stored in separate table.

                              BaseEntity table will have columns 'Name', 'SpecialStatus_Id', 'SpecialStatus_Id1'

                              Try to change the name of the column:
                              modelBuilder.Entity<InheritedEntity2>().HasOptional(p => p.SpecialStatus).WithOptionalDependent().Map(i => i.MapKey("SpecialStatus_Id"))
                              modelBuilder.Entity<InheritedEntity3>().HasOptional(p => p.SpecialStatus).WithOptionalDependent().Map(i => i.MapKey("SpecialStatus_Id"))

                              and get an ModelValidationException:
                              "One or more validation errors were detected during model generation:
                              SpecialStatus_Id: Name: Each property name in a type must be unique. Property name 'SpecialStatus_Id' is already defined.
                              "

                              7 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                I agree to the terms of service
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                              • Persistent caching of auto-compiled queries

                                I know that EF code first automatically compiles queries and caches the results. But "Cold" queries are so slow.. Is possible to persist auto-compiled queries somewhere in the database so EF won't need to re-compile them again if that cache is lost (app restarted).

                                6 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  I agree to the terms of service
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                • Improve performance of adding many entities to DbContext (DetectChanges, AutoDetectChangesEnabled)

                                  The performance hit of adding (and possibly other operations) many entities to the context is so big, that you've introduced the AutoDetectChangesEnabled switch https://msdn.microsoft.com/en-gb/data/jj556205.aspx. This increases the code complexity and leads to nasty bugs. This is not ok and should be redesigned to work fast out-of-box. E.g. by upgrading from EF5 to EF6, due to this feature, the performance of some code has degraded by many orders of magnitude

                                  6 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    I agree to the terms of service
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                    0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                  • More precise log messages

                                    When I was experimenting with EF7 and mapped an identity column to a Int64 property, I got an exception. Unfortunately the exception did not told me:
                                    - which entity
                                    - which property
                                    had that mapping error...

                                    So really, instead of having 2 pages of stack trace, those 2 words would have been more useful... NHibernate does this, don't tell me that a new ORM (almost 1 and a half decade after the birth of NH) is not capable of doing at least the same as the old ORM...

                                    6 votes
                                    Vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      I agree to the terms of service
                                      Signed in as (Sign out)
                                      You have left! (?) (thinking…)
                                      0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Create method should initializer collection navigation properties

                                      I've found that in Code First entities, my "many" properties such as

                                      property List<People> SomePropertyName {get; set;}

                                      are null when the entity is instantiated. This breaks the common "convention" of just simply adding entities to the list:

                                      You can't just
                                      MyEntity.SomeManyProperty.Add(SomeOtherEntityInstance);

                                      You have to do
                                      MyEntity.SomeManyProperty = new List<SomeOtherEntity> { SomeOtherEntityInstance };

                                      but, of course, you can't just do that, because you might wipe out an existing list, if there is one, so you must then do a check first. Ugly.

                                      As a lesser evil, I've resorted to instantiating empty lists in the constructor of my entities but this is…

                                      6 votes
                                      Vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        I agree to the terms of service
                                        Signed in as (Sign out)
                                        You have left! (?) (thinking…)
                                        5 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Optional Convention that assigns Default Value to not nullable types

                                        When using code first with an existing database, the "can not assign null to a non nullable type" exception can be realy painfull, because the compiler gives no warning, when i project a int? to a int.

                                        It would be very usefull to have a Convention / Configuration that enables the automatic use of GetValueOrDefault for these cases.

                                        6 votes
                                        Vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          I agree to the terms of service
                                          Signed in as (Sign out)
                                          You have left! (?) (thinking…)
                                          0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Support for generic complex types

                                          You should support for using generic complex types. Consider scenerio where I would like to create Rage<T> type. Now I must create RangeOfInt32, RangeOfInt64, RangeOfDecimal, etc. It will be also great if that class could be defined outside of the model.

                                          6 votes
                                          Vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            I agree to the terms of service
                                            Signed in as (Sign out)
                                            You have left! (?) (thinking…)
                                            0 comments  ·  runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                          • Don't see your idea?

                                          Entity Framework Core Feature Suggestions

                                          Feedback and Knowledge Base