entity-framework

The HTTP verb POST used to access path '/Membership/user/' is not allowed

This code: private void Submit_Click(object sender, RoutedEventArgs e) { user temp = new user(); temp.Username = UserName.Text; temp.Password = Password.Text; dataBase.AddTouser(temp); IAsyncResult result = dataBase.BeginSaveChanges(new AsyncCallback (OnSaveChangesCompleted), temp); } void OnSaveChangesCompleted(IAsyncResult res...

Entity Framework Generated SQL for Entity Mapped to a View

I've mapped an EDM entity to a database(SQL Server 2005) View. The entity is a simple Movie Entity which has properties of ID, Name and DateInserted which corresponds to a View which has the following definition: SELECT iMovieID, vchName, dtInsertDate FROM dbo.t_Movie WITH (NOLOCK) The table t_Movie has the following definition...

Linq To Entity SelfReferencing Relation Mapping

How do you map a table called category with Id as Primary Key which has self reference called ParenCategoryId using LinqToEntity? ...

How to create relationship mapping via Entity framework

I have following domain model: User { int Id; } City { int Id; } UserCity { int UserId, int CityId, dateTime StartDate } In the function where I have to attach a user to a city, the following code is working for me: UserCity uc = new UserCity(); //This is a db hit uc.User = MyEntityFrameworkDBContext.User.FirstOrDefault(u => u.ID ...

ADO.NET Entity Framework and a Joined Subclass

Can you do a Joined Subclass in the Entity Framework version 1? How do you approach the issue? Joined Subclass: http://www.xylax.net/hibernate/joinedsubclass.html http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/hibernate/Hibernate_Reference_Guide/Mapping_declaration-joined_subclass.html ...

How to Add a Many-To-Many Relation in Entity Framework

I am a newbie. I have been able to Add new entities where there is a One-To-Many Relation. I am having a problem (don't Know how to do it) adding a new Entity when the relation is using Many-To-Many. In my EDM I have: Orgs <Scalar Properties> a. Org_ID (Identity Field) b. OrgName c. OrgDesc <Navigation Properties> Building_orgs_Re...

C# Listbox Bound to Entity "Entity Framework"

On my WinForm, I bound my listbox to a Table in Entity on EDMX, but when the table data is changed, I tried to call myListBox.DataSource = Entities.table; myListBox.ResetBindings(); myListBox.Refresh(); but nothing happens in ListBox. The Entities.table object holds the right data though, it just doesn't reflect on the ListBox. Any ...

Does Entity Framework/LINQ to SQL Data Binding use reflection?

Forgive me if this has been asked before; I did a search but couldn't find anything that specifically answered this question, but I'd be happy to be referred. I'm taking a peek at both the Entity Framework and LINQ to SQL, and while I like the systems (and of course the LINQ integration) I'm a little skeptical on the data-binding aspect...

how to create insert query on the fly, in entity framework using create query method?

I am using something like the above sample code but when i try to execute it, it says that the query syntax is wrong and there is an error in the query syntax near keyword into... System.Data.Objects.ObjectParameter[] opc=new System.Data.Objects.ObjectParameter[1]; //just sample opc[0]=new System.Data.Objects.ObjectParameter("columnna...

Silverlight/WPF Many to Many List of Checkboxes Binding

I have an entities model with a many to many relationship. For simiplicity, lets assume its a car entity and a feature(cd player, moonroof, etc.) entity. I have a Silverlight/WPF form in which you edit the car entity. I would like to have the list of possible features (everything in the features table) be a list of checkboxes. That par...

A many to many connection with a field in the entity-network

I want to make a many to many connection with a field in it. example: User -----works (hours)----- Company Hours is a field in the many-to-many table. The field describes how many hours a user works in the company. How is this best modeled in the entity framework? Can you even model this without making a entity out of the connection ...

Paging Support - ADO.NET Entitry Framework and LINQ

What kind of paging support is offered through ADO.NET EF and LINQ? What does a "first 10" Select look-like? A "next 10" Select? ...

Ado.Net Entity Data Model Not Updating Correctly

Hi, I've done the following steps: - Open visual studio - Create new item - Select "ADO.Net Entity Data Model" - Point it to an existing database - Accept all the defaults. - It then adds a "Model1.edmx" file to my solution and the corresponding "Model1.Designer.cs" file. However in the output I get the following error: "ERROR: Una...

ADO.NET Data Services: How to filter a entity based on foriegn keys?

Hi This might be a entity framework related question, anyway, here goes: Consider the following simple database schema: CREATE TABLE Supplier( SupplierId int identity(1,1) not null primary key, DisplayName nvarchar(50) ) CREATE TABLE Category( CategoryId int identity(1,1) not null primary key, DisplayName nvarchar(50)...

ADO.Net Data Model. How do you find a string's Max Length

Hi, I'm using the ADO.Net Data Model and would like to truncate any string that are over the database field's max length. I can see the info in the .edmx xml but I can't find it in C#. On save I'd like to truncate string so I don't get sql errors. I found this post but it uses Linq and I could not find the CustomAttributes in my co...

Linq to Entities (EF): How to get the value of a FK without doing the join

I'm using the Linq to Entities. I've got my main table, Employee setup with a field named vendorID. Vendor ID is a foreign key into the Vendors table. As it is right now, the Employee object does not directly expose the vendorID. Instead, I can only access it this way: var employee = (from e in context.Employees.Include("tbl_vendors") ...

Cannot add Entity Data Model in Visual Studio

I am running Visual Studio 08 Team Edition with .NET Framwork 3.5 SP1 on WinXP. I am trying to add a Entity Data Model to my project, however, the option to add an "ADO.NET Entity Data Model" selection does not appear. To give you a visual, I am essentially following the directions here ( http://www.aspfree.com/c/a/ASP.NET/Introduction...

Need advice on selecting a data access method

I am in the early stages of planning a conversion of a large classic ASP database application to ASP.Net and I'm having trouble picking out which data access method to use. I have played around with Linq To SQL, Dynamic Data, strongly typed datasets, Enterprise Library (Data Access Application Blocks), and a tiny bit with Entity Framewo...

Entity Framework using views and stored procedures.

I have the following basic table structure (that I'm not allowed to change) in my database: Address (PK) AddressId Line1 ... Person (PK) PersonId (FK) AddressId FirstName ... Student (PK) StudentId (FK) PersonId StudentNumber ... I would like to combine Person and Student into a Student entity using the Table-per-Type approach. How...

Entity Framework + POCO

I am building a WPF application using the MVVM pattern. Our stack looks like this: SQL Server 2008 -> Entity Framework We use StructureMap for dependency injection to inject our DataFactory which essentially does the CRUD for our POCO business objects. The ViewModels use the DataFactory for CRUD and the xaml is data bound to the prop...