About 50 results
Open links in new tab
  1. Using DbContext Set<T>() instead of exposing on the context

    Reviewing the decompiled source, the DbSet will be the same instance per instance of a DbContext (e.g., if you call context.Set<T> () multiple times, you get the same reference to the same DbSet, …

  2. When do I need to specify DbSet in EF's DbContext?

    I'm a little bit confused. Until today I thought that every table (used by EF) must be specified in DbContext class. But it looks like I need ONLY one! really? Let me explain, Here's my DbContext: ...

  3. c# - Difference between DbSet<T> property and Set<T> () function in …

    fooContext.Set<Bar>().Add(new Bar()); // Approach 2 What is the difference between the two approaches? I've tried to answer my own question by: Inspecting the intellisense for both (only tells …

  4. Decimal precision and scale in EF Code First - Stack Overflow

    Aug 17, 2010 · Is there a EF configuration to set it for all decimal properties on all entities in one place? We generally use (19,4) . It would be nice to have this automatically be applied to all decimal …

  5. StringLength vs MaxLength attributes ASP.NET MVC with Entity …

    StringLength vs MaxLength attributes ASP.NET MVC with Entity Framework EF Code First Asked 14 years, 9 months ago Modified 4 years, 4 months ago Viewed 179k times

  6. ef core doesn't use ASPNETCORE_ENVIRONMENT during update …

    Aug 25, 2017 · I have now tried all kinds of ways but when I run the update-database with ef core 2.0 it doesn't use the ASPNETCORE_ENVIRONMENT variable. I tried to set in registry, application …

  7. Map stored procedure with multiple resultset returned in EF Core

    Jul 4, 2019 · Use an external approach from EF Core For point 1, please read this question: EF Core query stored procedure map to types For point 2, please read this question: Working with multiple …

  8. How to add/update child entities when updating a parent entity in EF

    I set the children (once) because instead of manually deleting and adding items to the collection I can simply replace the list and entityframework will add and delete items for me. The key is setting the …

  9. c# - How to get return values and output values from a stored …

    May 12, 2017 · 11 I am working to convert some EF6 code to EF Core, and ran into this same issue. In Microsoft.EntityFrameworkCore version 2.1.0 the following use of FromSql() does return a result set …

  10. Ef core migration with different startup project - Stack Overflow

    Nov 17, 2021 · If you are in your core project, you should be able to run dotnet ef without specifying --startup-project. If you have to specify - then there is a different process; namely, something is wrong …