c# - Postsharp/Reflection Conflict -
I have 2 basic classes entity
and EntityCollection
and all of them In the data class underlying entity class constructor, I wanted to call this method:
public static zero InitAllCollection (object o) {foreach (var propertyinfo in o.GetType). GetRuntimeProperties ()) {if (PropertyInfo.PropertyType.IS CONSTOCKED GENERIC TYPE [propertyInfo.PropertyType.GetGenericTypeDefinition ()! = TYPE (EntityCollection & lt; & gt;)); Var ctor = propertyInfo.PropertyType.GetTypeInfo (). DeclaredConstructors Where (C =>? C.GetParameters (). Any ()). Select (C = & gt; c) .FirstOrDefault (); PropertyInfo.SetValue (o, ctor.Invoke (new object [0])); }}
This method was automatically a member of all the EntityCollection
unit, so I do not need to duplicate the code.
And everything until I posted the NotifierPropertyChanged aspect to the quickest aspect of the posting that worked fine after that code propertyInfo.SetValue (o, ctor.Invoke ( New object [0]));
truing is TargetInvocationException
.
Can I tell in some way the EntityCollection
to exclude the generic postsharp or to summon them at least before the constructor ends.
Edit: The InitAllCollection
method is called unit
in addition to the constructor it is a project for Windows 8.1
Comments
Post a Comment