For simple Example, I've 2 tables (and Entities), Prices (PriceID primary key, CategoryID, price) and Category (CategoryID primary key, CategoryName). I've relation FK_Prices_Category
I was made EDM with stored proc - all OK. But I can't make Deleting prom Price entity.
My code:
01 VmzkoPricesEntities ctx = new VmzkoPricesEntities();
02 VmzkoPricesModel.Prices pr = ctx.GetPriceByID(newsID).First();
03 ctx.DeleteObject(pr);
04 ctx.SaveChanges(true);
GetPriceByID - is an imported stored proc with output of all fields of Prices (PriceID, CategoryID, price) BUT if I expand 'pr' object (line 02) then property Category is NULL.
After that deleting is not available: Entities in 'VmzkoPricesEntities.Prices' participate in the 'FK_Prices_Category' relationship. 0 related 'Category' were found. Between 1 and 1 'Category' are expected.
How can I fill Category property inside Prices object by using stored proc???
How can I fill that by alternative method?