entity-framework-4
Adding multiple inherited instances of different children types in a TPT Mapping EF4.1
Given the model: public abstract class Person { public int Id {get;set;} } public class Customer : Person[详细]
2023-04-13 09:44 分类:问答Entity framework ToList() isn't working
I have some code like this: var db = new MYContext(); var invoice = new Invoice { InvoiceId = 7 }; db.Set<Invoice>().Add(invoice);[详细]
2023-04-13 09:12 分类:问答Validation failed for one or more entities. See 'EntityValidationErrors' property for more details [duplicate]
This question already has answers here: Getting exact error type in from DbValidationException (8 answers)[详细]
2023-04-13 08:53 分类:问答Insert multiple records issue (linq EF)
I need to insert multiple records to different tables, the problem is that some tables have 2 different foreing keys and the EF throws me an exception. Part of my schema is shown below.[详细]
2023-04-13 08:09 分类:问答Using MVC3 and EF4, how can one adequately test functionality that relies on a round trip to the database to create IDENTITY values?
I have a scenario where the code under test inserts a record into a database, then attempts to retrieve it back from the database using its primary key.[详细]
2023-04-13 07:48 分类:问答How do I prevent InvalidOperationException saving a cyclic graph of entities?
Given the entities, class A { B DefaultB { get; set; } C DefaultC { get; set; } } class B { A { get; set; }[详细]
2023-04-13 07:47 分类:问答EF Code first database/table initialization - WHEN does it happen?
My application is using EF code-first design and all generally works very well. Via a private configuration file, I can specify how I would like EF to handle changes to the db schema, and so create/r[详细]
2023-04-13 06:32 分类:问答Using a predicate to find all rows?
I have the following code, I am using the repository pattern in EF 4.1 and Unit of Work. However because I dont understand very much how Expression and Predicates works I ask the following:[详细]
2023-04-13 06:19 分类:问答many to many relationship in EF 4.1
I am just doing a small application with 3 tables. Applicants Positions ApplicantsPerPosition. This last one would be a many to many relationship with the other 2 tables.[详细]
2023-04-13 05:50 分类:问答Create a generic method where a expression can be passed as parameter to make dynamic queries
I am using EF. and the repository Pattern. The specific question is how can I write the GetPositionByCustomExpression below so that from the caller I can pass an expression, sometimes the expression[详细]
2023-04-13 04:31 分类:问答