asp.net mvc - Breezejs inline count -


in breezecontroller:

public iqueryable<entities> index() {     return this.context.entities.where(e => e.value > 100); } 

breeze query query.inlinecount(true) returns count after where, how can return count of entities before statement or manually set count response? know filters, in task need statement right in action.

works me

[breeze.webapi.breezecontroller] public class mybreezecontroller : system.web.http.apicontroller {     private readonly breeze.webapi.efcontextprovider<mydbcontext> context         = new breeze.webapi.efcontextprovider<mydbcontext>();      [setinlinecountfilter]     [breeze.webapi.breezequeryable]     public system.linq.iqueryable<myentity> index()     {         return this.context.context.myentities.where(e => e.value > 100);     } }  public class setinlinecountfilterattribute : system.web.http.filters.actionfilterattribute {     public override void onactionexecuted(system.web.http.filters.httpactionexecutedcontext actionexecutedcontext)     {         var content = (system.net.http.objectcontent)actionexecutedcontext.response.content;         var result = (breeze.webapi.queryresult)content.value;         result.inlinecount = 42;         base.onactionexecuted(actionexecutedcontext);     } } 

now can value of inlinecount anywhere , add code pass filter

or doing sevrer-side breeze work manually:

[breeze.webapi.breezecontroller] public class mybreezecontroller : system.web.http.apicontroller {     private readonly breeze.webapi.efcontextprovider<mydbcontext> context         = new breeze.webapi.efcontextprovider<mydbcontext>();      public queryresult index()     {         return new queryresult                    {                        inlinecount = 42,                        results = this.context.context.myentities.where(e => e.value > 100)                    };     } } 

and query options request this.request.requesturi.query


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -