-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GlassMapper v4 - InferType no longer working #132
Comments
Hi Thanks for bring this to our attention. I have release update 4.0.1.5 to fix this issue. Please update your Nuget packages. Mike |
Perfect! Appreciate the quick turn around! |
I may have just spent 4 or 5 hours trying to figure out how to get inferred types working on a new project before I stumbled onto this... Thanks for the fix Mike! |
Can anyone confirm if this is still working correctly in 4.2.1.190 |
Sadly, I have a similar error when using 4.2.1.189. 😢 |
@n-develop, I'm pretty sure this specific error has been resolved. My guess, if you're still having this problem, is that you're not registering the dll with your models with glass mapper. |
Could be true. I will check it tomorrow at work. Thank you for the tip, @ssartell. |
I am using Glass Mapper version 4.4.0.199 and seems InferType is also not working there. |
Same here. Any updates has this been fixed in later versions? |
I have successfully used InferTypes in many versions of Glass in V4, have you loaded the types required in your GlassMapperScCustom using an AttributeConfigurationLoader? |
Hello. Yes I have. I have supplied correct assembly name in AttributeConfigurationLoader. We noticed that it randomly works. When site gets booted, or we do new publish locally, it stops or starts working again. I found out while debugging it takes sometimes correct interface type and sometimes that interface it inherits. |
I used to see that behaviour when Glass couldn't figure out the correct type - often where 2 different types had the same template id |
Wow, that was the case. Thank you so much for pointing this out! |
Have just upgraded a solution to GlassMapper v4 and am having some trouble with a page that uses inferred types (other pages seem to be working fine).
In the solution we have the following model:
There are various other templates that inherit from
IBaseElementCard
, not shown.This was previously working in v3, though required the configuration to be preloaded (as described here):
As part of the upgrade to v4, I ensured that this loader code was ported across. However, it does not seem to be having an effect and we are now getting the error we previously got in v3 before applying this fix:
The model item passed into the dictionary is of type 'Castle.Proxies.IBaseElementCardProxy', but this dictionary requires a model item of type 'Project.Glass.Models.IElementCardContent'.
IElementCardContent is one of the derived types.
Any ideas? Have I missed something obvious in the upgrade? I've stepped through the solution and the
GlassLoaders()
method is definitely getting called.The text was updated successfully, but these errors were encountered: