• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

WCF, Linqs and WPF


  Please, explain if I'm correct.

  I have two tables (clients and cities). They are obviously connected by city code. If wish to see all the clities I create a service in WCF as a Linq call returning a List (because WPF ListView needs a List) and this List<CITIES_TABLE>, looks like this. IEnumerable is not recognized by WPF in Blend. In this code Linq defines automaticaly the class that explains the table structure.

  Now I wish to query the clients and its cities by its names. In this case I need to create a special class that brings data from clients and cities tables? My return must br List<CLIENTS_CITIES>. There is no way to create this return not declaring it by hand code?

  Marco Castro
1 Solution
Best way that I know is to create a Stored Procedure with Joined query and where clause.
Also any parameter you need to filter by which will be in your where clause.

Then just drag you Stored Procedure to DBML (DBML is created when you create a Linq-To-SQL class).
This will create a class needed for what you need to do.

Note: Stored Procedure must return a Resultset (not just Integer).

Then you would create WCF Web Service to access this Stored Procedure.


Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now