c# - return a specific datafrom wcf -


my method this:

public list<civartransporteservice.model.cliente> getclientes()     {         using (civartransporteservice.model.civartransportemodelcontainer context = new model.civartransportemodelcontainer())         {             return context.cliente.tolist();          }     } 

and cs:

public interface icatalogsservice {     [operationcontract]     list<civartransporteservice.model.cliente> getclientes(); } 

actually getclientes return fields of clientes database need name of client how this? thx

you can use linq select extension method name column. need update method signature return list of string now.

assuming name property of client entity

public list<string> getclientes() {    using (var context = new model.civartransportemodelcontainer())    {        return context.cliente.select(x=>x.name).tolist();        } } 

and interface signature well

public interface icatalogsservice {     [operationcontract]     list<string> getclientes(); } 

or if not want update existing interface , it's implementation, can @ whererever calling it.

icatalogsservice catalogservice; catalogservice = new someconcretecatalogservice(); // not best "new" up.                                                 // not real question here. var clientnamelist = catalogservice.getclients().select(s=>s.name).tolist(); 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -