entity-framework

Entity Framework or NHibernate

Possible Duplicates: ADO.NET Entity vs NHibernate nhibernate, entity framework, active records or linq2sql Hi all, I'm going to choose a ORM tool for the new project. Just wondering which one is better? Entity Framework or NHibernate? Please give some suggestions according to your own experience. Thanks ...

Pros and Cons of using ASP.NET MVC with Entity Framework?

What are some pros and cons of using ASP.NET MVC with Entity Framework in .NET 4.0? Any 'gotchas' in live scenarios? ...

How to report that custom (added) Calculated Property of entity object has changed?

First, I apologize for my low level English writing. I use Entity Framework and data-binding in WPF MVVM project. I would like to know what is the best way to do data binding to added calculated property of EntityObject which is generated with Entity Framework. For example: partial class Person { partial string Name....

Preloading entities with EF4

I have a bunch of classificators which will be used quite often. I wan't to preload those entities when my program starts so that I wouldn't have to do it later when any object references them. How can this be done in EF4? ...

Does Entity Framework automatically cache the ModelBuilder model?

I am developing an ASP MVC application using Entity Framework. I was thinking of writing code to cache the object returned by ModelBuilder (as is recommended by several sources), but then I ran into this on Scott Gu's blog: "The OnModelCreating method above will be called the first time our NerdDinners class is used within a running app...

Entity Framework 4 and POCO

I'm trying to get started using the latest Entity Framework 4 release on Visual Studio 2010 to create a simple WCF application. I would really like to start using POCO objects as opposed to EntityObject classes to serialize. I have been looking for some good write-ups about how to implement custom POCO mappings for Entity Objects but can...

Code First CTP4 for EF4 - how to map multiple entities (common base) to single table

I have a large table that I want to map to a few entities. Say the table looks like this: Thing(ThingId, Property1...Property20) Now I have my entities: public abstract class ThingBase { public int ThingId { get; set; } public string Property1 { get; set; } public string Property2 { get; set; } } public class ThingSummary...

Expression generated based on interface

I'm geting the exception Unable to cast the type 'MySomeTypeThatImplementsISomeInterfaceAndIsPassedAs[T]ToTheClass' to type 'ISomeInterface'. LINQ to Entities only supports casting Entity Data Model primitive types. my repository looks like public interface IRepository<T> { IQueryable<T> Get(System.Linq.Expressions.Expression<Syste...

Using the .NET 3.5 Entity Framework how can I save an entity?

I have for example a table called Client. Usually in .NET 4 I would do: dbEntities.Clients.AddObject(myClienteObject); but in .NET 3.5 I cannot find this method, any suggestions? ...

Setting a foreign key value using Entity Framework .NET 3.5?

My table: Employee -------- Name Age Role int (foreign key) How can I assign a textbox value to the Role column? In Entity Framework 4 I would go: Employee x = new Employee() x.Role = textBox1.Text; It seems I don't have the Role columns available to me. Thanks. ...

How to create a group of methods/properties within a class?

I am using entity framework with a web service and I have entity partial class objects that were generated automatically by the web service. I would like to extend these classes, but I would like to group them in the generated class in a way similar to the way a namespace would (except inside a class). Here is my generated class: publ...

Linq paging - how to solve performance problem?

Edit: Entity Framework seems to be the issue, discussed further in question Entity Framework & Linq performance problem. I am supporting a PagedList (using linq/generics) class written by someone long departed - and it has 2 lines that have very bad performance - on a dataset of just 2 thousand rows it takes up to one minute to run. Th...

Flexible Persistence Layer

I am designing an ASP.NET MVC 2 application. Currently I am leveraging Entity Framework 4 with switchable SQLServer and MySQL datastores. A requirement recently surfaced for the application to allow user-defined models/entities to be manipulated. Now I'm unsure if a SQL/relational database is appropriate at all; instead of adding/removi...

Entity Framework & Linq performance problem

I have a performance problem with Entity Framework and Linq, when paging a list of Product objects: var data =_service.GetAll(); var page = data.Skip((index) * pageSize).Take(pageSize); list.Add(page.AsEnumerable); // ** its slow right here There are 1958 products in my test database, but when the above code runs I can see 3916 (that...

MS EF 4 and SPROC

Hi, I had a look at EF 4 (Entity Framework) from MS (notice I am a beginner :-). I understand its use for separation of Layer Logic as DAL. In EF 4 I see it is possible to create code for query the Data Base, query are stored in DAL. My questions is what could be the benefit of using SPROC with EF 4? To me calling SPROC from the EF 4 ...

Updating nullable boolean fields in the Entity Framework

Changes to nullable bool properties are not saved back to the db in EF4 however other fields which are nullable are updating without any issues. For example, if I execute simple query similar to the following: EmployeeSurvey employeeSurvey = context.EmployeeSurveys.SingleOrDefault(s => s.EmployeeSurveyID == 60); employeeSurvey.Employee...

what's spring framework?

hi everyone. i'm begginer for java spring framework. and how to configuration xml file. and what do to do modules. how to use those? mainly how to use spring framework? please advice me guys. ...

Entity Framwork 4 and Targeting the Correct SQL Server Version

I am using the Code Only approach with Entity Framework 4. I have a SQL 2008 database, however I would like my solution to be compatible with SQL 2005. I understand that when using a .edmx file the "ProviderManifestToken" can be set to "2005" to accomplish this. How can the ProviderManifestToken be set when using the code only approac...

Entity Framework 4 Code-First many to many insert

I'm using code-first pattern for database layer. I have two POCO classes: public class Order { [Key] public int OrderId { get; set; } public virtual ICollection<Item> Items { get; set; } // other fields } and public class Item { [Key] public int ItemId { get; set; } public virtual ICollection<Order> Order...

Trouble with FK in EF after WCF round-trip

Hi there I'm working on a distributed app with a server and a client, where the server exposes services via WCF. The server uses the Entity Framework, and its various methods return EntityObjects. In the client, I have no references to the server. So in the client, the classes are wholly generated proxies. I have a delete method in th...