entity-framework

Single Connection String with Multiple Entity Framework Models?

At work we currently have a very large web application with a connection to a massive database. We have been using Entity Framework for a while now and to make things easier we divided the database into many Entity models. This works well for us but we ran into an issue. Each EF model needs its own connection string due to the metadata p...

Entity Framework 4.0 - Including entities - Eager loading problem

We have 3 tables in our db that each have an entity in our edmx. To illustrate my problem, imagine 3 tables: Table: Make Fields: makeID make Table: Model FIelds: modelID makeID foreign key model Table: Car carID modelID foreign key car Our Make, Model, and Car entity have all of the navigation properties in the entity model. La...

Is Entity Framework ObjectContext correct implementation of Unit Of Work Pattern?

Entity Framework 4 - STE - simple DB with single table Blogs having BlogID PK column... var samplesDbEntities = new SamplesDBEntities(); var blogId = Guid.NewGuid(); samplesDbEntities.Blogs.AddObject(new Blog() { BlogID = blogId }); var objectSetResult = samplesDbEntities.Blogs .Where(p => p.BlogID...

Entity Framework, Code only & EntityDataSource

Hi, I have an objectcontext and code-only definition of my model. How do i use the EntityDataSource to connect? Is there a way to define a connectionstring to my ObjectContext class? ...

The socket connection was aborted. Possible SerializationException?

I'm receiving this error message when trying to return data from a WCF service. "The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9960000'" It is misleading...

WCF Data Service Many-to-Many Relationship with EF4

I'm writing an ASP.NET MVC 2 application that uses Entity Framework 4 and WCF Data Services. I want to manipulate the many-to-many (composite key) relationship between Duties and Workers based on the state of some checkboxes. A Worker may have zero or more duties. A Duty may have zero or more workers. This code is from one of my contr...

Round-trip Property on Entity Framework entity

Hi, I have a Candidate entity that is read/write to a Candidate table under EF 4.0. This all works great but I need to load another type of Candidate from our existing membership table via a stored proc and Function Import. From the applications POV they are also a Candidate they just happen to have an additional attribute of Grade. ...

Creating an Entity Data Model from an Empty model

I may be confused here (or over my head). I am trying to connect to an IBM i (aka iSeries) and I want to try to use the Entity Data Model to implement this. The help I have found online has been less than helpful for me. How do I add the logic needed to interface with the .edmx file and thus be used in the rest of my application? Most ...

EF4 code only approach for many-to-many relationships

I have the following: Product POCO ProductConfiguration class for EF code only (CTP3) Product table in database ProductCrossSell table in database My Product and ProductConfiguration class looks like: public class Product { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual IColl...

How I can programmatically retrieve a primary key for an entity (in Entity Framework 4) ?

I have this base abstract class which implements repository pattern public abstract class Repository<T> : IRepository<T> where T : class { private ObjectSet<T> _entitySet; private ObjectContext _dataContext; public Repository(ObjectContext context) { _dataContext = context; _e...

Passing objects to methods...

I always thought I understood how this works...but lately I have started really using interfaces and now things arent doing what I am expecting. using entity framework, I have a service for each object that is responsible for interacting with the database and such....on my one service I am passing the collection of objects to my servic...

Why not to use Classes that generated by EF in large Projects ?

Hi everyone. I'm going to use Entity Framework 4 in sort of big project. And i know that many professional programmers advice to depend on my business classes instead of EF Model classes. Actually there is sound inside my brain tell me "Don't depend on that generated classes !. Just make your hand dirty with your stuff don't let some...

Entity Framework 4 - Delte many-to-many

Hello anyone and everyone, Please can you help me to enable the deleting of books from my database? I am using EF 4 and have a many-to-many relationship between books and authors. When I try to delete a book, I get the following: he DELETE statement conflicted with the REFERENCE constraint "FK_BookAuthor_Book". The conflict occurred i...

Error using ASP.NET Dynamic Data Filtering with Entity Framework

I have just added the Dynamic Data Filtering library to an Entity Framework based Dynamic Data web application, but on trying to access List.aspx, I get the following error. Is there anything I can do about this on .NET 4? The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called befo...

Combing tables with one-to-many relationships into a single entities in ADO.NET Entity Framework 4.0

Hi, I'm aware you can map multiple storage tables to a single entity if they have a one-to-one relationship in EF 4.0. Example: (storage) (1)Table: People Columns: Name, Age (2)Table: Customers Columns: Registered -- Relationship: People <1-1> Customers (concept) Entity: Customers Columns: Name, Age, Registered I'm wo...

Refreshing a silverlight ListBox

I am trying to buid a forum in silverlight. I am using RIA services, EF4 and silverlight 4. I have a datagrid with topics. When the row is clicked on, the threads for that topic are added to a listbox. Everything is working correctly with one exception: When a new thread is added, the listbox does not update its contents unless I click...

How to learn transaction in EF or LINQ to SQL?

i try to learn transaction scope. Everything looks good. i try to control transaction is running i add 500 char in NAME value (Name nvarchar(50) normally). While My formApplication not running (it is normal), i try to open a table table is empty. Stop running my app form . i can see values of Tables. WHY? using (var ctx = new DataClass...

Sqlite .NET and Entity Framework - "attempt to write a readonly database"

---edit--- Is there any additional information I can give to help solve this problem? I'm trying to get up and running with a Sqlite and Entity Framework within a .NET WCF web service. When I try to save anything to the database, I'm getting the error "attempt to write a readonly database". Here's the full error information: System...

Can entities in Entity Framework inherit from an entity that is not mapped to a table?

Hi, I am using Entity Framework POCO to generate some self-tracked data objects, and I exposing these objects from a WCF service interface. I have EntityA & EntityB, which both map to different tables in the database. I would like both EntityA and EntityB to inherit from a base 'Entity' class, so that I can implement a simple WCF serv...

Entity framework: check if there are changes to be saved

Hello! is there a way to find out whether there are unsaved changes in my entity context, in the Entity Framework? Thanks! ...