entity-framework

Restrict Serializing Entire Object Graph When Calling WCF Service to Update a EntityObject

We have a WCF service that uses Entity Framework to query a SQL database. The WCF service is our data access layer. If any of our applications what to read/write data to and from the database, we call a method on the WCF service. The WCF service serializes the EntityObjects to the client apps. In the client app (e.g. WPF app or ASP.NET ...

Entity framework not loading relationship even when using include

I have this code: Category selectedCategory = (from c in DB.Category.Include("SubCategory") join a in DB.Accessory on c.AccCatUID equals a.Category.AccCatUID where a.AccUID == currentAccessory.AccUID select c).FirstOrDefault(); It works fine, selectedCategory gets populated as expecte...

Entity Data Model with Oracle

Hi, I'm using VS 2008 SP1. I want to create an edmx file using my existing database in Oracle 10g. I tried to add ADO.Net Entity Data Model item, but in the Entity Data Model Wizard, .NET Provider for Oracle does not show up. Can someone suggest a way to connect to existing Oracle database to generate the edmx file? Thanks. ...

Entity Framework - refresh objects from database

I'm having trouble with refreshing objects in my database. I have an two PC's and two applications. On the first PC, there's an application which communicates with my database and adds some data to Measurements table. On my other PC, there's an application which retrives the latest Measurement under a timer, so it should retrive measure...

LinqKit System.InvalidCastException When Invoking method-provided expression on member property.

Given a simple parent/child class structure. I want to use linqkit to apply a child lambda expression on the parent. I also want the Lambda expression to be provided by a utility method. public class Foo { public Bar Bar { get; set; } } public class Bar { public string Value { get; set; } public static Expression<Func<Bar...

What's Differences Between Using Entity Framework in Vs 2008 And 2010

You know firstly Entity Framework came with Visual Studio 2008 SP1. Now it is come with Visual Studio 2010. The question is that, what are differences between these two version? ...

Entity Framework: admin site generator

Hello. Is there any tool to generate CRUD admin site from Entity Framework Model? Something like PLINQO has built in. Thank you. ...

Does moving to EF 4 need to target .net 4 ?

Hi I have a .net 3.5SP1 project with EF (1 i guess). How the upgrade to EF4 occurs ? I need to target .net 4 ? Thanks Jonathan ...

'Invalid attempt to read when no data is present' - exception happens "sometimes" in Entity Framework

I get the above error sometimes during the read. The exception originates from ASP.NET SqlDataReader whenever you try to read data before calling the Read() method. Since EF does all these internally, I am wondering what else can cause this error. could it be network (or) db connectivity? thanks ...

Update a single field from a single entity with ria-services

There are situations where I only want to update a specific field of a single entity in the database. I loaded the entities of that type into my silverlight application, and I know they are constantly changing on the server... but there is one field which has to be set by the silverlight client... the server will only read it. How can I...

Issues with LINQ (to Entity) [adding records]

I am using LINQ to Entity in a project, where I pull a bunch of data (from the database) and organize it into a bunch of objects and save those to the database. I have not had problems writing to the db before using LINQ to Entity, but I have run into a snag with this particular one. Here's the error I get (this is the "InnerException", ...

Add Or Condition to Entity in Entity Framework

Can you add an "Or" condition to an entity in the entity framework? For example something like: Property1 == (1 or 2 or 3) The message I get when putting the value of "1 || 2 || 3" or "1,2,3" or "1 or 2 or 3" returns this message: condition is not compatible with the type of the member ...

Correct way to edit and update complex viewmodel objects using asp.net-mvc2 and entity framework

I have a table in my database with a one to many relationship to another table, which has a relationship to a third table: ParentObject ID Name Description ChildObject ID Name Description ParentObjectID AnotherObjectID AnotherObject ID Name The objects are mapped into Entity Framework and exposed through a data access cl...

Save entity with entity framework

Hi, I'm saving entities/records with the EF, but i'm curious if there is another way of doing it. I receive a class from a MVC controller method, so basicly i have all the info: the class's properties, including the primary key. Without EF i would do a Sql update (update table set a=b, c=d where id = 5), but with EF i got no further th...

entity framework vNext wish list

I have been intensively studying and use ef4 in my project. I do feel the improvement that it has over version 1. But I found that I have something I cannot get around easily. Here is a list I want it to be better in ef vNext. the model designer should allow multiple view of the same model, so that I don't need cram all my entity into ...

Implicit Lazy Loading vs Explicit Lazy Loading

I've been reading Entity Framework and people were crying over why there was not implicit lazy loading or something. Basically I've been searching things about Lazy Loading and now I know what it is : It is a design pattern which allows us to load objects when they are really needed. But what is the difference between Explicit Lazy Loa...

How can I return IEnumarable data from function in GridView with Entity Framework?

protected IEnumerable GetPersonalsData() { // List<Personals> personel; using (FirmaEntities firmactx = new FirmaEntities()) { var personeldata = (from p in firmactx.Personals select new { p.ID, p.Name, p.SurName }); return personeldata.AsEnumerable(); } } I want to send GetPersonelData() into GridView DataSourc...

Managing EntityConnection lifetime

There have been many question on managing EntityContext lifetime, e.g. http://stackoverflow.com/questions/813457/instantiating-a-context-in-linq-to-entities I've come to the conclusion that the entity context should be considered a unit-of-work and therefore not reused. Great. But while doing some research for speeding up my databas...

Entity Framework lazy loading doesn't work from other thread

Hi, I just found out that lazy loading in Entity Framework only works from the thread that created the ObjectContext. To illustrate the problem, I did a simple test, with a simple model containing just 2 entities : Person and Address. Here's the code : private static void TestSingleThread() { using (var context = new Te...

ORM For .Net ON Oracle

I'm gonna start a new project soon, using .Net 3.5 and Winform on an Oracle database. We were planning on using an ORM. NHibernate was suggested by our architect. Since I'm personally more familiar with Entity Framework, I thought it would be easier to use than NHibernate. But since there isn't any official provision from Oracle, we are ...