Continuing on after my initial WebApi Filtering and paging a projection Dilemma
Breeze $filter projections thread
I am now trying to update my backend database with little success.
Giving the Fact that I am:
public IQueryable<ConsigneDTO> Consignees(string refname)
{
IQueryable<ConsigneDTO> q = this.db.Consignes
.Where(x => x.Refname == refname)
.Select(f => new ConsigneDTO {Refname = f.Refname, Consignee = f.Consignee, Address1 = f.Address1, Address2 = f.Address2, Address3 = f.Address3});
return q;
}
Whats the easiest way to put this data back from Breeze?
I see my changed data coming back in both overrides
protected override bool BeforeSaveEntity(EntityInfo entityInfo)
{
}
protected override Dictionary<Type, List<EntityInfo>> BeforeSaveEntities(Dictionary<Type, List<EntityInfo>> saveMap)
{
}
But no easy way to push these into the underlying context which is a WCF service stemming from Data.Services.Client.DataServiceContext.
How do I call
Context.UpdateChanges(EntityInfo);
or
Context.UpdateChanges(SaveMap);
Especially Considering EntityInfo and SaveMap contains DTO?
Must I completely ignore the SaveChanges() mechanism and do my own CRUD calls? I don't even see any good non-breeze examples on updating projections, which make me feel this is deep rooted.
As explained in prior thread, I can change most things about this project. The only issues I have are the databases are on another server and has columns that cannot be public and my only way at the tables are EF5.
I've chosen to wrap EF thinly using OData-v3 / WCF-Data-Services and access them from my breeze controller on the web server.
So far readingqueryingfiltering and paging are all working great on SPA, but with only the R of "C_UD", I'm more then willing to rework this project.
Kind Regards Mike
See Question&Answers more detail:os