json - What is the best way in WebMatrix to query WCF services? -


i have asp.net project using razor view engine queries various databases directly webmatrix.data.database.open.

i'm trying migrate direct database access web services using wcf consistent business logic. in doing this, have enabled wcf service "httpgetenabled". allows me use excel macros query same web service.

my question is, best way query these web services razor/webmatrix page?

should json enable wcf service , use webmatrix json helper? or should using jquery xml?

i assume former best way, how json enable wcf service? remember seeing video allowed me specify additional query parameter wcf request json, can't find again.

any thoughts or pointers in right direction appreciated.

kind regards.


edit:

i've seen on stack overflow : client side binding using converting wcf services json

on following this, went msdn article referred around webhttpbehavior. have since added "automaticformatselectionenabled=true" webhttp element in web.config. in addition, added following code allowed me specify "format=json" query parameter:

string formatquerystringvalue = weboperationcontext.current.incomingrequest.uritemplatematch.queryparameters["format"]; if (!string.isnullorempty(formatquerystringvalue)) {     if (formatquerystringvalue.equals("xml", system.stringcomparison.ordinalignorecase))     {         weboperationcontext.current.outgoingresponse.format = webmessageformat.xml;     }     else if (formatquerystringvalue.equals("json", system.stringcomparison.ordinalignorecase))     {         weboperationcontext.current.outgoingresponse.format = webmessageformat.json;     } } 

i need work out how use webmatrix json helper results... update when more information.


edit 2

hmm, don't think helped... can json webservice, json web helper seems if have json data already. i'm not sure how json data can use json helper convert (decode) class.

so guess question is, how json data , bridge webmatrix/razor use in webgrid?

from read want know best practice in case if correct.

the best practice know not make website query through wcf @ all.

why ? -because both located on server... no point creating connection again data. should both have direct connection data webmatrix.... use wcf other applications .exe created stores farm animals.

extra note: can add wcf asp.net project , both access same database best case if still require it.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -