I thought I’d share this approach to having named associations. Let’s say you have an Address class with a Name property on it, your Employee can have a property like this 1 var homeAddress = new Address(.....);
2 homeAddress.Line1 = "192 Blah Street";
3 homeAddress.Line2 = "etc";
4 employee.Addresses["Home"] = homeAddress;
5
6 var workAddress = new Address(.....);
7 workAddress.Line1 = "123 Meh Road";
8 workAddress.Line2 = "etc";
9 employee.Addresses["Work"] = workAddress;
Once you have created your Employee and Address classes add a private association from Employee to Address named something like _Addresses. Then add the following code to the Employee class.
1 IdentifiedAssociation<string, NamedPostalAddress> postalAddresses;
2...
I found a few examples of web servers for MonoTouch but none of them parsed the data sent in a POST request. I looked around the web and was unable to find any examples of how to achieve this. So now that I’ve written it myself I’ve decided to share my own implementation. This includes not only the code for processing the form post data but also for registering request handlers etc. Here is an example of how you would use the web server 1 public BookUploadViewController()
2 ...