Geeks With Blogs
.Nettuce Code Salad January 2013 Entries
Model Binding using Expression Trees
object Bind(object requestDto, NameValueCollection formData) { var propertyGroups = formData.AllKeys.Where(x => x.Contains('.')).GroupBy(x => x.Substring(0, x.IndexOf('.'))); foreach (var group in propertyGroups) { var propertyName = group.Key; var propertyInfo = requestDto.GetType().GetPro... var propertyType = propertyInfo.PropertyType; var bindings = new List<MemberBinding>(); foreach (var childPropertyKey in group) { var childPropertyName = childPropertyKey.Substring(... ......

Posted On Thursday, January 24, 2013 8:27 PM

Copyright © Jon Canning | Powered by: GeeksWithBlogs.net