entity-framework

EF Change detection for pure poco

I have a code sample like this using (MyContainer container = new MyContainer (connectionString)) { container.ContextOptions.ProxyCreationEnabled = false; IQueryable users = from user in container.Users where user.UserName == myuserName select user; User claimUser = us...

.NET APP trouble writing group by and join clause with edmx

i have the following working query in mysql... select * from events e join performance_times pt on e.id = pt.event_id where pt.performance_date_only > '2010-08-10 00:00:00' group by pt.performance_date_only I am having issues getting the group by to work when using this with my edmx file in my mvc app. I have it working with the jo...

EF 4 with POCO in class library as MVC 2 model

I am exploring Entity Framework 4 with POCO as my Model for an MVC2 web app. The reason I'll need the model and data access code in a separate library is so I can share it with another web application that serves as a portal for our clients to access our data. My question is, will I lose any of the typical MVC2 Model features by having ...

Add a calculated field to asp.net mvc model

I'd like to have a list that will shorten a field value if it is too long from a linked Entity Data Model. Something where I could take the following: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcDR.Models.DONOR_LIST>>" %> <asp:Content ID="Content1" Content...

storing entity framework self tracking entities in asp.net session, good idea?

let us assume that I have a reusable business layer that further makes use of a data access layer that was implemented using Entity Framework 4.0. The entities returned/consumed by the business layer are self-tracking, allowing us all the goodies that come with those type of entities. I would like to be able to store the entities I wor...

Self Tracking Entity - Loading Navigation Property of a Navigation Property

I am curious what the best practice is for this situation in Entity Framework 4.0. I have the following Entity Map: Entity A -> Entity B -> Entity C Where Entity A contains a list of Entity B's which each contains a list of Entity C's. I am using self tracking entities and when I load Entity A I am doing something similar to this: Ent...

EF4 Model-First entities "non-partialable" when used in separate project.

I cracked open the tekpub EF4 series last weekend and replaced my subsonic stuff that I started with on a new site. I was a little miffed to find however, that with my entities in a separate domain project, I could not "partial" the entities on my MVC2 app. I did the awful thing of putting my EF4 model right in my app and then it worked ...

How does Entity Framework relate a custom POCO to a table?

I am attempting to add a new EF4 POCO to an existing solution. I am getting following error, and when I look at existing POCO already created in the solution I cannot work out how the link is made between the POCO and the table. Mapping and metadata information could not be found for EntityType 'XXX.Run'. Here is an example of one ...

Entity Framework 4 INNER JOIN help

Hello, Can anyone tell me how to write the following query in Entity Framework 4.0? "Blogs" and "Categories" are my entities. The query basically returns me the list of categories and the number of blogs that are in that category. SELECT b.CategoryId, c.Value, Count(b.Id) AS [Count] FROM dbo.Blogs b INNER JOIN dbo.Categories c ON b.Cat...

Entity Framework 4 Lazy Loading When It's Not Needed; Using Wrong Key

I have a problem in EF4 where a query that I have returns the data that I want into an anonymous type, but when I try to move the data into a "real" type (I'm creating new instances of my EF objects) some data that the code has already pulled down from the database gets lazily loaded and for the lazy load it's using the key from the prev...

Is my 3-tier (n-tier) architecture good design?

Hello: I am developing a medium sized ASP.NET project using ASP.NET MVC and Entity Framework. I have developed a 3-tier system by setting up 3 Visual Studio projects and referencing them accordingly: Presentation -- This is my MVC project and contains all the views and controllers. I deleted the model folder completely from this proje...

RIA Services + Entity Framework 4 + POCO's : 'The Timestamp field is required' error?

I've the following table definition in MSSQL: CREATE TABLE [User] ( [Id] bigint identity(1,1) NOT NULL, [Email] nvarchar(256), [PasswordHash] nvarchar(128) NOT NULL, [PasswordFormat] int DEFAULT ((0)) NOT NULL, [PasswordSalt] nvarchar(10) NOT NULL, [Timestamp] timestamp ) ; The EDMX property for Timestamp loo...

Cannot drag tables from Server Explorer to .edmx designer pane.

Why can't I drag tables from the Server Explorer to the .edmx designer pane? I've done this before in the exact same steps and it worked, but since yesterday instead of getting the classic + sign for dropping items, I get the no entry symbol (circle with slash in the middle). What am I doing wrong? As I said, I've done this before but n...

How can i insert dataset into sql table with same columns in Entity FrameWork?

i get all column values from Users to StandardUsers id,Name,SurName and PostCount data to add. But Return below error: IN " entityUsers.GetType().GetProperty(columnNames[i]).SetValue(entityUsers, columnValues[i], null);" Return To Me Error : Set method of characteristics not found. public static class MyDynamicInsertCustomerExtension...

EntityFramework and MySQL with LINQ

I'm trying to use EntityFramework to work with MySQL database from c#. I'm using MySQL Connector 6.3.3, but i'm unable to use the linq syntax like context.Items.Where(x => x.Id == 3) I only see the following overload for Where: Where(string predicate, params ObjectParameter[] parameters); Is there a provider or something that could...

EntityFramework 4.0 POCO Proxy Problem

I see a lot of people asking a similar question, but not this exact one. I'm trying to do what I would hope would be relatively simple with POCO proxies. using (var context = new MyObjectContext()) { context.ContextOptions.ProxyCreationEnabled = true; // this does indeed create an instance of a proxy for me... // ...

Entity Framework table per hierarchy error 3034

I have an Entity Framework model using table per hierarchy. The base class is abstract and there are two derived classes. I want to create associations between these two derived classes and another class. These are many-to-many relations so go through a joining table. Adding the first association is ok, but when I add the second i get ...

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

i have a one entity framework object and when i add it to my project, the connectionstring is add to app.config in connectionstring section, but when i want create new entitycontext and use this connectionstring, this error is appear ...

DomainService only works with EDMX file?

I want to add a new domain service class within vs2010. I choose my entity framework database context in the dialog "Add New Domain Service Class", but it doesen't show me the available entities. If I click "ok" VS2010 gives me the following error message: --------------------------- Microsoft Visual Studio --------------------------- V...

Many to Many Relationship Keys

Hi Everyone, I have 2 entity objects (table1 and table3) with a many to many relationship via an intermediary table (table2) containing only the 2 PK/FK keys. With the relationship manager I can view the end points of the relationship (table1 and table3) but I need to know the name of "table2" and the names of the PK/FK fields in table...