entity-framework

Entity Framework with MySQL - Timeout Expired while Generating Model

I've constructed a database in MySQL and I am attempting to map it out with Entity Framework, but I start running into "GenerateSSDLException"s whenever I try to add more than about 20 tables to the EF context. An exception of type 'Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine+GenerateSSDLExceptio...

MVC / EF Query -- A better way?

Objective: Get a list of name|id pairs for a select list from table A where the id does not exist in a filtered collection of Table B records. Constraints: Using MVC 1.0, Entity Framework (no L2S, DataContext, etc.), C# My question is whether there's a smarter way to go about doing this than what I've got working so far--which just s...

Error while Detaching Entities in Entity Framework v1

Hello, I'm using .NET 3.5 SP1. Using VS2008 Designer, I created entity 'Category' based on table 'Category' and 'AppUser' based on table 'AppUser' and 'AppUserDetail' based on table 'AppUserDetail'. DB TABLES: CREATE TABLE [Category]( [CategoryId] [int] NOT NULL, [CategoryName] [varchar](50) NOT NULL, PRIMARY KEY ([Categ...

Entity Framework - Change Relationship Multiplicity

I have a table [User] and another table [Salesperson] in my database. [Salesperson] defines a unique UserID which maps to [User].UserID with a foreign key. When I generate the model with Entity Framework I get a 1-to-Many relationship between [User]-[Salesperson], meaning that each User has a "Collection of Salesperson", but what I want ...

ADO.NET Entity Framework Association of Entities by Value Range

I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association between these elements based on whether or not HouseNumber falls between StartHouseNumber and EndHouseNumber. However, I can only seem to get ...

ADO.NET Entity Data Model are not precise enough

I run this code: var cos = from k in _db.klienci_do_trasy where k.klient_id == 5 select k; but the query send to database is: SELECT * FROM `klienci_do_trasy` LIMIT 0, 30 why is it for, there is no condition on klient_id? ...

Post back complex object from clent side

Hi All, I'm using ASP.NET MVC and Entity Framework. I'm going to pass a complex entity to the clent side and alow the user to modify it, and post it back to the controller. But I don't know how to do that and whether the client side entity will lost relationship tracking of EF as it is detached from object context. Any ideas? Thanks in...

ADO.NET entity data model deleting many rows

I have following structure of the database CREATE TABLE IF NOT EXISTS `klienci` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nazwa` varchar(50) NOT NULL, `miejscowosc` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `klienci_do_trasy` ( `klient_id` int(...

ADO.NET Entity Data Model - order of executing query

When I run this code: korlenEntities2 _db = new korlenEntities2(); for (int i = 0; i < 10; i++) { klienci klient = new klienci(); klient.nazwa = "Janek_" + i.ToString(); klient.miejscowosc = "-"; _db.AddToklienci(klient); }; _db.SaveChanges(); rec...

How to insert many2many table into entity

Hi all, I have a entity and a many to many table associate with it. Because the many2many table have a nchar field, it can not be mapped to a association in EFv1. Is that possible to create a Entity hold both the original entity and the nchar field? Thanks! ...

When creating a new record, how do I fill some fields with values from the filter?

I'm working on an ASP.NET page, which basically is a quick hack around a database. It's used for an internal project and the site is set up in a way to provide several people read/write access to the data. Once a week, we collect a bunch of data from it, add it to an XML file and send it as part of an application update to our customers....

Entity Framework - Many to many question

I have a table called ASB and a table called PeopleInvolved. There is a junction table called PeopleInvolved_ASB which simply contains an ASBID and a PeopleInvolvedID column. The columns act as a composite primary key. The designer does not show the junction table (as expected). I want to retrieve a list of PeopleInvolved based on an AS...

MySQL and EntityFramework

Hi! First sorry for my English =) I use MySql Connector/NET 6.2.0. EntityFramework Data model generation for MySQL database with foreign keys takes hours!!! regards, Khilko Pavel. [email protected] ICQ 245188743 ...

Differences between ASP.NET MVC framework and Entity Framework

Hi, I'm going to be starting a new project with ASP.NET and I would like to use some framework which speed up the process. Recently I have heard that there are two main frameworks in that platform: the MVC and the Entity framework. Are they compatibles? If not, what are your advices on what to use and why? What are they best properties?...

L2S (LINQ to SQL) or EF (Entity Framework)

I'm going to rebuilt an existing moderate-scale web-app to be used for a supply-chain-management web-solution. The core would be around some Item\Site combination-records, Organization\User management, display Organization specific data (a dashboard with 2 levels of Grid) and a Drilldown which has some complex calculations for Item trans...

Linq to enties, insert foriegn keys

I am using the ADO entity framework for the first time and am not sure of the best way of inserting db recored that contain foreign keys. this is the code that i am using, I would appreciate any comments and suggestion on this. using (KnowledgeShareEntities entities = new KnowledgeShareEntities()) { Question...

Entity Framework with File-Based Database

I am in the process of developing a desktop application that needs a database. The application is currently targeted to SQL Express 2005 and works wonderfully. However, I'm not crazy about having this dependency on SQL Express and would prefer to use a small file-based database. My problem is that I am using Entity Framework. I have ...

how to write linq query based on EF?

Suppose I have three tables: Person(pid, ...) PersonAddress(pid, aid,...) Address(aid, ...) Then I want to get the person address like sql: select a.* from address a join PersonAddress pa on a.addressID=pa.addressID where pa.personID = myPersonID Use Entity Framework to create Entity model, then want to write a linq equivalent as ...

Refresh relationships in Entiy Framwork

When clicking the Update Model From Database option in an EF data model, any relationships between tables are not refreshed. The only way I can find to achieve this is to delete and readd the edmx file, is there another way? ...

How Do I Create And Update A Many To Many Relationship With EF

I am using the Entity Framework with SQL Server. I have a many to many relationship between 2 tables. I have created a join table with just the primary key fields of the 2 tables. In the designer, the 2 tables now have a navigation property to the other with return types of Collection of X where X is the other entity. So far, everything ...