Im trying to implement the PageEntity as described by Per Hemmingson here

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

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

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

Aug 14, 2009 11:42

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);


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" /> 


Aug 14, 2009 22:55

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.
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.