Skip to main content
Filter by
Sorted by
Tagged with
885 votes
29 answers
964k views

I am having this error when seeding my database with code first approach. Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. To be honest I don't ...
Luis Valencia's user avatar
842 votes
12 answers
715k views

I have a problem with Entity Framework in ASP.NET. I want to get the Id value whenever I add an object to database. How can I do this? According to Entity Framework the solution is: using (var context ...
ahmet's user avatar
  • 8,443
817 votes
31 answers
606k views

I'm looking for the fastest way of inserting in Entity Framework. I'm asking this because of the scenario where you have an active TransactionScope and the insertion is huge (4000+). It can ...
Bongo Sharp's user avatar
  • 9,638
734 votes
47 answers
569k views

All of a sudden I keep getting a MetadataException on instantiating my generated ObjectContext class. The connection string in App.Config looks correct - hasn't changed since last it worked - and I've ...
J. Steen's user avatar
  • 15.6k
658 votes
10 answers
360k views

What are the pros & cons of using Entity Framework 4.1 Code-first over Model/Database-first with EDMX diagram? I'm trying to fully understand all the approaches to building data access layer ...
Jakub Konecki's user avatar
601 votes
36 answers
474k views

After downloading EF6 via NuGet and trying to run my project, it returns the following error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. ...
Fernando Vellozo's user avatar
539 votes
10 answers
428k views

The Include() method works quite well for Lists on objects. But what if I need to go two levels deep? For example, the method below will return ApplicationServers with the included properties shown ...
Bob Horn's user avatar
  • 34.5k
466 votes
10 answers
255k views

I see this a lot in tutorials, with navigation properties as ICollection<T>. Is this a mandatory requirement for Entity Framework? Can I use IEnumerable? What's the main purpose of using ...
JC JC's user avatar
  • 12.2k
449 votes
9 answers
122k views

I have been reading a lot of articles explaining how to set up Entity Framework's DbContext so that only one is created and used per HTTP web request using various DI frameworks. Why is this a good ...
Andrew's user avatar
  • 11.4k
445 votes
5 answers
188k views

How would you rate each of them in terms of: Performance Speed of development Neat, intuitive, maintainable code Flexibility Overall I like my SQL and so have always been a die-hard fan of ADO.NET and ...
BritishDeveloper's user avatar
430 votes
14 answers
302k views

There is an entity type called Product that is generated by entity framework. I have written this query public IQueryable<Product> GetProducts(int categoryID) { return from p in db.Products ...
Ghooti Farangi's user avatar
423 votes
39 answers
550k views

I have developed an application using Entity Framework, SQL Server 2000, Visual Studio 2008 and Enterprise Library. It works absolutely fine locally, but when I deploy the project to our test ...
The Light's user avatar
  • 27.2k
407 votes
10 answers
444k views

I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue: I added ...
Halcyon's user avatar
  • 15k
384 votes
18 answers
330k views

I've mucked up my migrations, I used IgnoreChanges on the initial migration, but now I want to delete all my migrations and start with an initial migration with all of the logic. When I delete the ...
Kind Contributor's user avatar
370 votes
4 answers
314k views

I have been investigating transactions and it appears that they take care of themselves in EF as long as I pass false to SaveChanges() and then call AcceptAllChanges() if there are no errors: ...
mark smith's user avatar
357 votes
45 answers
424k views

I am using Entity Framework to populate a grid control. Sometimes when I make updates I get the following error: Store update, insert, or delete statement affected an unexpected number of rows (0). ...
strongopinions's user avatar
341 votes
12 answers
357k views

I can't find way to add a unique constraint to my field with using attribute: public class User { [Required] public int Id { get; set; } [Required] // [Index("IX_FirstAndSecond", 2, ...
Vadim M's user avatar
  • 3,465
335 votes
20 answers
943k views

I am trying to update a record using EF6. First finding the record, if it exists, update. Here is my code: var book = new Model.Book { BookNumber = _book.BookNumber, BookName = _book.BookName,...
user1327064's user avatar
  • 4,347
328 votes
7 answers
156k views

I have this scenario: public class Member { public int MemberID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public virtual ICollection&...
hgdean's user avatar
  • 3,283
312 votes
22 answers
622k views

I am very new to Entity Framework 6 and I want to implement stored procedures in my project. I have a stored procedure as follows: ALTER PROCEDURE [dbo].[insert_department] @Name [varchar](100) ...
Jaan's user avatar
  • 3,423
301 votes
9 answers
351k views

I have a controller action that works fine on Firefox both locally and in production, and IE locally, but not IE in production. Here is my controller action: public ActionResult MNPurchase() { ...
user547794's user avatar
  • 14.6k
285 votes
11 answers
193k views

My impression to date has been that a DbContext is meant to represent your database, and thus, if your application uses one database, you'd want only one DbContext. However, some colleagues want to ...
Josh Schultz's user avatar
  • 8,190
277 votes
3 answers
124k views

public class Foo { public string FooId{get;set;} public Boo Boo{get;set;} } public class Boo { public string BooId{get;set;} public Foo Foo{get;set;} } I was trying to do this in ...
taher chhabrawala's user avatar
271 votes
23 answers
416k views

I'm working on a ASP.Net Core 2.0 project using Entity Framework Core <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.1" /> <PackageReference ...
André Luiz's user avatar
  • 7,422
269 votes
3 answers
165k views

Can someone please explain what a GroupJoin() is? How is it different from a regular Join()? Is it commonly used? Is it only for method syntax? What about query syntax? (A c# code example would be ...
duyn9uyen's user avatar
  • 10.5k

1
2 3 4 5
1837