You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Index.SaveObject(pocoModel) dont work when ObjectId is in baseclass of POCO.
==> You get error: The type {nameof(T)} must have an ObjectID property or a JsonPropertyAttribute with name='objectID.
The issue is your AlgoliaHelper.PropertyOrJsonAttributeExists() function is wrong.
The reflection it uses to check for public properties is incorrect/wrong:
var typeInfo = typeof(T).GetTypeInfo();
var declaredProperties = typeInfo.DeclaredProperties; <=== !!!! this is wrong. !!!!!!!!
the DeclaredProperties will not retrieve the baseclass properties.
==> this is why it is not seeing ObjectID ==> because ObjectID is in base class.
The fix is to use this code:
var declaredProperties = typeof(T).GetProperties();
==> this will give you all the public properties (even the one in the base class..)
Please apply this fix asap. We are trying to use your 6.0.0 version in production as soon as possible.
Thank you.
The text was updated successfully, but these errors were encountered:
We didn't use typeof(T).GetProperties(); because we are supporting .NET Standard 1.0 and this method is not available in this one. However, you're right that DeclaredProperties isn't retrieving properties of the base class. Hopefully, there is a way to retrieve the base class properties with DeclaredProperties. I'll submit a PR today with the fix and I'll ship a fix with 6.0.1 in a few days.
The Index.SaveObject(pocoModel) dont work when ObjectId is in baseclass of POCO.
==> You get error: The type {nameof(T)} must have an ObjectID property or a JsonPropertyAttribute with name='objectID.
The issue is your AlgoliaHelper.PropertyOrJsonAttributeExists() function is wrong.
The reflection it uses to check for public properties is incorrect/wrong:
var typeInfo = typeof(T).GetTypeInfo();
var declaredProperties = typeInfo.DeclaredProperties; <=== !!!! this is wrong. !!!!!!!!
the DeclaredProperties will not retrieve the baseclass properties.
==> this is why it is not seeing ObjectID ==> because ObjectID is in base class.
The fix is to use this code:
var declaredProperties = typeof(T).GetProperties();
==> this will give you all the public properties (even the one in the base class..)
Please apply this fix asap. We are trying to use your 6.0.0 version in production as soon as possible.
Thank you.
The text was updated successfully, but these errors were encountered: