London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

PageEntity-problems

Vote:
 
Im trying to implement the PageEntity as described by Per Hemmingson here http://tinyurl.com/n3fede

Installed the SQL-tables and SP's. Modifed the PageEntity code and added the provider and supportTypes to web.config.
I added a property (private PageEntity _currentPageEntity;) to my page base class and implemented the get/set as Per did in the WikiX example.

When I try to get the currentPageEntity from the current page I get an exception in the PageEntityFactory class, method ConstructPageEntity which calls GetEntityProvider.

"The entity provider does not exist for type Namespace.UI.Public.PageEntity.PageEntity."

the method looks like this:

PageEntityTypes pageEntityTypes = (PageEntityTypes)reader.GetInt32(2);
Type entityType = PageEntityUtils.GetPageEntityType(pageEntityTypes);

// The variables above seems ok and contains expected data
return (PageEntity)EntityProviderHandler.GetEntityProvider(typeof(PageEntity)).GetEntityInstance(entityType, reader);

GetEntityProvider gets it's info from web.config so I have probably done something wrong there but I can't figure out what.

Here's the relevant sections from web.config

<entity>
<providers>
<add name="PageEntity" type="Namespace.UI.Public.PageEntity.PageEntityProvider, Namespace"/>
</providers>
<supportedTypes>
<add type="Namespace.UI.Public.PageEntity.ArticlePageEntity, Namespace" provider="PageEntity" />
</supportedTypes>
</entity>

I did some reflecting and debugging. GetEntityProvider reads from a private member m_entityProviderHash.
It contains (among several others) [{Namespace.UI.Public.PageEntity.ArticlePageEntity}]: {Namespace.UI.Public.PageEntity.PageEntityProvider}
but should contain Namespace.UI.Public.PageEntity.PageEntity right?

Anyone got any ideas?

/Fredrik, confused

#31902
Aug 14, 2009 11:42
Vote:
 

I haven't tried this myself, but I think that the problem might be remedied if you change

return (PageEntity)EntityProviderHandler.GetEntityProvider(typeof(PageEntity)).GetEntityInstance(entityType, reader);

to

return (PageEntity)EntityProviderHandler.GetEntityProvider(entityType).GetEntityInstance(entityType, reader); 

Or, add the fully qualified type PageEntity to the supportedTypes list for the 'PageEntity' provider,

<add type="Namespace.UI.Public.PageEntity.PageEntity, Namespace" provider="PageEntity" /> 

/Kristoffer 

#31914
Aug 14, 2009 22:55
Vote:
 

I just tried changing to:

return (PageEntity)EntityProviderHandler.GetEntityProvider(entityType).GetEntityInstance(entityType, reader); 
And it seems to be working just fine. 
I tried you second suggestion before posting and it did not work.
 
Thanks
/Fredrik
#32024
Aug 20, 2009 10:22
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.