Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework)

My feedback

  1. 22 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…)
      2 comments  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
      Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

      @Marc: probably a good idea to create an issue for that on http://github.com/aspnet/entityframework/issues

    • 3,228 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…)
        Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

        @Dirk Watkins: enums mapped to a table would not be part of the *simple* type mappings and type conversions feature we have planned. Consider voting for https://data.uservoice.com/admin/forums/72025-entity-framework-feature-suggestions/suggestions/2683498.

      • 285 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…)
          8 comments  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →

          @Marius Vorster: Thanks for the feedback. This is a feature we would like to add in the future. In EF7 we are laying off some of the necessary infrastructure in the form of query annotations, and we would accept a contribution in this area.

          In the meanwhile for EF6, at least for very simple cases it is possible to append OPTIONS() at the end of queries using a query interceptor, e.g.:

          class SimpleOptimizeForUnknownInterceptor : DbCommandInterceptor
          {
          public override void ReaderExecuting(
          DbCommand command,
          DbCommandInterceptionContext<DbDataReader> interceptionContext)
          {
          command.CommandText = command.CommandText +
          " OPTION (OPTIMIZE FOR UNKNOWN)";
          base.ReaderExecuting(command, interceptionContext);
          }
          }

          Usage is:

          DbInterception.Add(new SimpleOptimizeForUnknownInterceptor());

          Of course you will want to add some logic to control when this transformation applies, e.g. add a bool flag to your custom DbContext and then check for the state of that flag inside the interceptor.

        • 3 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  ·  Entity Framework Feature Suggestions » tools  ·  Flag idea as inappropriate…  ·  Admin →
            Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

            In EF7 we already try to use names from the query for tables and range variables, but not for properties of a projection like this. I would suggest you file a bug for this on http://github.com/aspnet/entityframework.

          • 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  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
              Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

              That the Create() method should initialize collections makes sense to me (although there might be reasons we didn't do it). Anyway, I renamed the idea so that others can vote for it if they want.

              Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

              Will, how exactly do you instantiate the entity? I am asking because I want to understand exactly what your expectations are. If you are using the new keyword in C# or VB to instantiate your entity then EF has no saying on the contents of your collections.

            • 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…)
                1 comment  ·  Entity Framework Feature Suggestions  ·  Flag idea as inappropriate…  ·  Admin →
              • 105 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…)
                  7 comments  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
                  Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

                  Added a comment on our EF7 work item fro cascade behaviors: https://github.com/aspnet/EntityFramework/issues/333

                  Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

                  Thanks DabblerNL for clarifying. If the target database does not support ON DELETE SET NULL, i.e. there is no declarative equivalent of ON DELETE CASCADE for nulling the FKs we would need to generate a set-based DELETE operation, e.g. DELETE FROM Product WHERE CategoryId = @categoryId. That would be a challenge since we currently don't have the ability to generate set-based CUD operations through our mapping, i.e. each CUD operation issued by EF affects one and only one row in a table based on the key of an entry on the state manager. Hence the requirement that entities are loaded for the FKs to be nulled.

                  @Sven: Could you please elaborate? What you are describing seems to be the default behavior of EF when cascade delete is not configured.

                • 2,119 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…)
                    19 comments  ·  Entity Framework Feature Suggestions  ·  Flag idea as inappropriate…  ·  Admin →

                    @abatishchev: Of the 17 "under review" ideas I looked at today are actually already being implemented in EF7, and at least one has been completed already for EF 6.1.2, and some are still being considered, just not committed to a release.

                    The feedback we get in this UserVoice site is fundamental to our planning and prioritization, even if many great ideas haven't been implemented yet and we don't know exactly when we are going to implement them. I prefer to be upfront about that and I realized earlier today that we were using the "under review" status incorrectly to tag ideas that we thought were very good rather than as an intermediary step that should lead to "planned", "started", "completed" or to "rejected" once reviewed.

                    On the other hand, since we started this UserVoice site we have completed or started to implement about half of the top 40 voted ideas. We have also implemented many of the top voted issues in our bug database at CodePlex:

                    https://entityframework.codeplex.com/workitem/list/advanced?keyword=&status=Closed&type=All&priority=All&release=EF%2b6.0.0%7cEF%2b6.0.1%7cEF%2b6.0.2%7cEF%2b6.1.0%7cEF%2b6.1.1%7cEF%2b6.1.2&assignedTo=All&component=All&reasonClosed=Fixed&sortField=Votes&sortDirection=Descending&page=0

                  • 54 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  ·  Entity Framework Feature Suggestions  ·  Flag idea as inappropriate…  ·  Admin →

                      There is now an "up for grabs" work item for this in our bug database: https://entityframework.codeplex.com/workitem/2388.

                    • 4 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  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →

                        EF' support for spatial was actually designed to translate LINQ queries containing spatial operations to SQL with spatial operations. If this isn't working for you please file bug in our CodePlex.com site including the code necessary to reproduce the issue.

                      • 188 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  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
                          Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) supported this idea  · 
                        • 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…)
                            1 comment  ·  Entity Framework Feature Suggestions  ·  Flag idea as inappropriate…  ·  Admin →
                            Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

                            Hi Eric, what you are seeing doesn't sounds like the expected behavior. We usually do put the generated complex types in the same namespace as the entity types. Could you file a bug and provide a repo? https://entityframework.codeplex.com/WorkItem/Create

                          • 274 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…)
                              Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) supported this idea  · 
                            • 5 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  ·  Entity Framework Feature Suggestions » tools  ·  Flag idea as inappropriate…  ·  Admin →

                                Note that the EF runtime already supports this but there aren't easy ways to do it in the designer and code first. I am reusing this item to refer specifically to the designer support since we already have another one that covers code first: https://data.uservoice.com/admin/forums/72025-entity-framework-feature-suggestions/suggestions/1953237-code-first-support-for-mapping-user-defined-functi

                              • 210 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…)
                                  Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

                                  Hi Erik,

                                  Thanks for the feedback. If you need the full performance of CompiledQuery with Code First, you can still use ObjectContext with Code First. The pattern to make it work requires a bit more of code than with DbContext, e.g. there is no OnModelCreating method or auto-discovery of entity types like the one you get based on the DbSet properties you put in the DbContext, but you can new up a ModelBuilder, tell it all about your model using the Entity<T>() method and when it comes to create the context instance you can write code similar to this:

                                  modelBuilder
                                  .Build(storeConnection)
                                  .Compile()
                                  .CreateObjectContext<MyObjectContextType>()

                                  Some notes on CreateObjectContext requirements are here: http://msdn.microsoft.com/en-us/library/system.data.entity.infrastructure.dbcompiledmodel(v=vs.103).aspx

                                  In the long run we would like to look at ways to close the perf gap between auto-compiled query and CompiledQuery. One idea in this regard is to attempt to create a query plan cache key based on the LINQ expressions directly without any further processing. We know that we cannot successfully do it for all LINQ expressions (because sometimes some evaluation is required to find out the full semantics of the query), but if we can do it for at least a large percentage of queries that would be a big gain and we can still fall back to the current implementation when that is not possible.

                                  Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

                                  Alexandre is right. With few exceptions EF 5.0 automatically caches all LINQ queries, so you might want to repurpose your votes for other ideas.

                                  Here are some more details:

                                  CompiledQuery can be used to improve performance of LINQ queries by skipping the process of computing the translation of a query after the query is first executed. However, CompiledQuery requires cumbersome variable declarations and nested lambda syntax that leads to less cleaner code than regular LINQ queries.

                                  Rather than enabling CompiledQuery on queries produced by the DbContext API we decided it was better to invest on making CompiledQuery less necessary in EF 5.0: We improved LINQ to Entities to be able to cache the query translation automatically for most regular inline LINQ queries.

                                  There is still a small gap between this automatic caching and real CompiledQuery though. For example, in internal testing a benchmark that executes 5000 time a query like this: context.Customers.First(c => c.Id == id) with 5000 different values for id resulted in the following times:

                                  - CompiledQuery in EF 5.0: 1.85 seconds
                                  - Auto-compiled query in EF 5.0: 2.76 seconds
                                  - Without caching in EF 4.0: 16.68 seconds

                                • 1 vote
                                  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  ·  Entity Framework Feature Suggestions » tools  ·  Flag idea as inappropriate…  ·  Admin →
                                  • 187 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…)
                                      2 comments  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                      Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) supported this idea  · 
                                    • 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  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                        Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) commented  · 

                                        By design the use of Include in a query only conveys the need to traverse a path of navigation properties and to load the associated objects found in the path. It does not apply filtering to the root query on which it is called.

                                        To implement Include with these semantics, EF needs to use LEFT OUTER JOINs in the general case.

                                        In EF5 and the updates to the EF core libraries in .NET 4.5 we made the query logic smarter to take advantage of additional information to decide when it is ok to use INNER JOIN instead of LEFT OUTER JOIN. E.g. if Include traverses a navigation property based on a non-nullable foreign key (i.e. a one-to-many association, as opposed to a cero-or-one-to-many association), it will use INNER JOIN because it knows that the starting entity will always have an associated entity on the other end.

                                        I would expect this improvement to help improve performance in many cases.

                                        On the other hand, what this idea is proposing seems to be an alternative to Include that filters the root query to only return objects that have associated objects in the path. I can imagine such alternative looking something like this:

                                        var q = db.Customers.IncludeRequired(c => c.Orders);

                                      • 66 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  ·  Entity Framework Feature Suggestions » runtime  ·  Flag idea as inappropriate…  ·  Admin →
                                          Diego VegaAdminDiego Vega (Engineering Manager, Entity Framework) supported this idea  · 
                                        • 1,845 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…)
                                            23 comments  ·  Entity Framework Feature Suggestions  ·  Flag idea as inappropriate…  ·  Admin →

                                            I have moved this idea from WCF Data Services to Entity Framework as it seems to refer to EF.

                                          ← Previous 1

                                          Feedback and Knowledge Base