I'm trying to set SqlParameters dynamically by mapping them to the respective parameters of an object which will be known during the runtime.
I just need to set its value if the object property is not NULL. Something like below:
e = Person.Name
I'm wondering if someone could help me with the IL code/DynamicMethod to accomplish this.
Person person = GetPerson();
SqlCommand command = GetSqlCommand();
for (int i = 0; i < command.Parameters.Count; i++)
System.Reflection.PropertyInfo propertyInfo =
//IL Code ...