WCF RIA Service, don't update data

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
hreyes
Posts: 2
Joined: Mon 07 Mar 2016 18:33

WCF RIA Service, don't update data

Post by hreyes » Mon 07 Mar 2016 19:25

Hi

I am using Entity Developer v5.8.803, Entity Framework 6 and MySQL

And using Domain WCF RIA service template, the insert code in the DataModelDomainService.cs is:

Code: Select all

public void InsertColor(Color color)
        {
            this.DbContext.Colores.Add(color);
            this.DbContext.SaveChanges();
        }
Everything is fine, but when I try to update a data set that the task is not completed

Code: Select all

 public void UpdateColor(Color currentColor)
        {
            this.DbContext.Entry(currentColor).State = EntityState.Modified;
            this.DbContext.SaveChanges();
        }
The answer that I get is:

There is already an open DataReader associated with this Connection which must be closed first.

And when I use this other code

Code: Select all

public void UpdateColor(Color currentColor)
        {
            this.DbContext.Colores.AttachAsModified(currentColor, this.DbContext);
        }
The answer is:

Attempt by security transparent method 'System.ServiceModel.DomainServices.EntityFramework.DbContextExtensions.AttachAsModified(System.Data.Entity.DbSet`1<!!0>, !!0, System.Data.Entity.DbContext)' to access security critical method

I don't know what is happening

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: WCF RIA Service, don't update data

Post by Shalex » Tue 08 Mar 2016 13:07

Please send us a small test project with the corresponding DDL/DML script for reproducing.

Post Reply