views:

22

answers:

0

Hi,

right now i try to implement the Inheritance property of the Entity Framework. I have two table in the database : DocumentLine and DocumentLineBudget. in EF designer, I will make the DocumentLine as a base class. The DocumentLineBudget as a derived class from the DocumentLine. Because of the Inheritance, there will have no availability for the EntitySet DocumentLineBudgets. And i want to retrieve the list of DocumentLineBudget so i create an operation service on the DocumentLineService.cs file like this

 public IQueryable<DocumentLineBudget> GetDocumentLineBudgets()
    {
        return this.ObjectContext.DocumentLines.OfType<DocumentLineBudget>().AsQueryable();
    }

On the client side, i want to feed the list of DocumentLineBudget into a gridview so i do this

dl_ctx = new DocumentLineContext();
EntityQuery<DocumentLineBudget> query = dl_ctx.GetDocumentLineBudgetsQuery();
LoadOperation<DocumentLineBudget> lop = dl_ctx.Load(query);
documentLineBudgetGridView.ItemsSource = lop.Entities;

the problem right now is that because lop.Entities will return an Ienumerable DocumentLineBudget , my gridview will disable the feature Insert/Delete but i want those feature to add/delete DocumentLineBudget.

I also check the help at http://www.telerik.com/community/forums/silverlight/gridview/mvvm-and-gridview-saving-change-ria-services.aspx In their sample project, they use EntityCollectionView to wrap over an EntitySet or EntityCollection to make the Insert/Delete work. However, i don't see anyway to wrap the Ienumerable one

Any help will be appreciated.

thank you