Attach Part to Type with Migration, cannot access through ContentManager.New

Topics: Customizing Orchard, General, Writing modules
Jul 16, 2012 at 5:47 PM

Odd situation that I can't figure out.

I have a type defined though a migration with a custom part attached to it at that time. I can go into the admin screen to the content types section and see that the type that I made does indeed have the part attached to it (though there is no link to "remove" the part). When I go to ContentManager.New("type") and subsequently inspect the "parts" enumeration, I see that the custom part is not there. I am not having any issues with other parts, just this part.

 

I know that it is limited to this part, but why can I see that the part is on the content type but can't access it through a contentmanager creation?

 

thank you very much.

Developer
Jul 16, 2012 at 6:28 PM

Does your part have a driver? If not, it can cause your part to be contained as a simple ContentPart object, not with it's real type.

Jul 16, 2012 at 8:10 PM

@Piedone : Yup, you nailed it! I went through and although I had a Driver, I had a different type in the ContentPartDriver<T>. I didn't realize I had done that (the two types were very similar in name). Without you telling me to look at the driver I would have spun my wheels for hours. thank you!

Developer
Jul 16, 2012 at 8:16 PM

I'm happy to help :-).