I got it sorted out with the help of DynamicLinq and Giacomo's
suggestion.

 PropertyInfo property = typeof(T).GetProperty(propertyName);
 if (property == null) {
   throw new ApplicationException("Property " + propertyName + " for "
+ typeof(T).Name + " could not be found, GetProperty failed.");
 }
 else {
   using (DataContext dataContext =
DBLinqContext.CreateDBLinqDataContext(m_storageType, m_dbConnStr)) {
     Table<T> table = dataContext.GetTable<T>();
     string idString = id.ToString();
     Expression<Func<T, Object>> mySelect =
DynamicExpression.ParseLambda<T, Object>(property.Name);
     var query = (from asset in table where asset.Id == idString
select asset).Select(mySelect);
     return query.FirstOrDefault();
   }
 }

Regards,

Aaron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to