This is my POCO object:
public class ExampleTestOfDataTypes
{
public float FloatProp { get; set; }
public BoolWrapper BoolProp2 { get; set; }
}
This is configuration file of the POCO
public class ExampleTestOfDataTypesConfig : EntityTypeConfiguration<ExampleTestOfDataTypes>
{
public ExampleTestOfDataTypesConfig()
{
this.Property(x=>x.FloatProp).HasColumnName("CustomColumnName");
}
}
This is definition of EntityTypeConfiguration (the property configuration is just for example)
ExampleTestOfDataTypesConfig config = new ExampleTestOfDataTypesConfig();
I need to go through all the properties of class ExampleTestOfDataTypes, find all the properties which dataTypes are derived from Wrapper (BoolWrapper is) and then get these properties using lambda expression. Or anyhow select them by config.Property(...)
Type configPocoType = config.GetType().BaseType.GetGenericArguments()[0];
var poco = Activator.CreateInstance(configPocoType);
foreach (System.Reflection.PropertyInfo property in poco.GetType().GetProperties())
{
if (property.PropertyType.BaseType!=null&&
property.PropertyType.BaseType == typeof(Wrapper)
)
{
//TODO: Set property
//config.Property(x=>x.[What here]); //?
}
}
Thanks