bug on child models when using modules

Dec 8, 2012 at 6:08 PM
Edited Dec 8, 2012 at 6:10 PM

I have declered a module named "Parties" in the designer. 

Within the designer i have added 2 models with a parent child inheritance relation :

BaseParty

--Person  

where Person model inherits from BaseParty model. 

but when i try to delete a person object using the following code 

 

 var startup = new ContextStartup("sa");
 using (var db = new DataEntities(startup, cnnstr))
{

   var party = db.Person.FirstOrDefault(x => x.ID == id);
     if (party != null)
      {
         db.DeleteItem(party);
         db.SaveChanges();

      }
}

 

i get an exception on line " db.SaveChanges();"

the exception says : 

"Could not find stored procedure 'dbo.gen_BaseParty_Delete'."

looking at the db there is no stored proc with that name , but there is a stored proc : 

gen_BaseParty_Parties_Delete

so i guess there is some confusion with names when using the modules feature.

yiannis

Coordinator
Dec 12, 2012 at 12:55 AM

You are correct. This has been corrected and will be in the next version. You can alternatively turn off stored procedure CRUD all together. This is what Entity Framework does by default anyway. Turn them off on the model and you will have no stored procs. In any case this issue is resolved and will be deployed soon.

Dec 13, 2012 at 6:49 AM
Edited Dec 13, 2012 at 6:54 AM

Thanks, 

As i workaround  i used the static method Person.DeleteData(x=>x.Id==id)

and it worked out fine.

Will continue this way until new version comes around.

 yiannis