Views, Web Services and Static Data

Topics: CAB & Smart Client Software Factory
Aug 10, 2007 at 2:24 PM
I have a simple query regarding populating List Controls such as a combo box or list box using a Service based architecture. Sorry if this isn't the place to post this. But I've ran into this issue when constructing a view using the Smart Client Software Factory.

I'll try and provide a simple example to explain:

If I define a View that for example displays data about a Person. The user can the update this data. The person data is obtained and persisted using a web service. The person entity has a number of attributes that are displayed using combo boxes. These values are managed and defined by other views.

My question is, what is the best way to populate those drop down boxes with the permissible values using this service approach. When the view if displayed I would need to populate the list controls with all permissible values.

For Example:

Should my Web Service look something like the following?

Service Definition

public IPersonService
{
PersonMetaDataResponse GetPersonMetaData() // This method returns all values to populate
// list controls.
Person[] GetPersons() // This method returns all persons.
UpdatePersonResponse UpdatePerson(Person person) // Updates the person.
}

Entities / Messages

public class Person
{
public string Name;
public DateTime DateOfBirth;
public string PersonType; // This would be selected from a combo box.
public string CreditRating; // This would be selected from a combo box.
public string MemberType; // This would be selected from a combo box.
other members...
}

public class PersonMetaDataResponse
{
public string[] PersonType;
public string[] CreditRatings;
other members...
}

So when the view is first loaded it would make a call to the PersonMetaData method to populate
all the list controls.

Does this make sense? and has anyone used a similar method to the above??