Move Dynamic Properties to Page Properties

Vote:
 

I'm trying to convert 400+ dynamic properties located on the start page to be standard page properties assigned to a custom global properties page setup solely to contain these properties. I believe this may aid my site performance due to the hit of going up to the top home page to retrieve these properties.

Anyhow I've been looking at the database table structures namely tblProperty and tblpagedefinition. I've moved a property from being a dynamic property on the home page to be a property on my custom global properties page. However the value against the property no longer shows through the edit UI and is blank. The row still exists within the database.

Any ideas? P.S. yes I've taken a backup first of my database.

#40974
Jun 25, 2010 16:06
Vote:
 

How did you convert your dynamic property to a "static" property? As I understand you want to convert both the property definition and move the value from dynamic to static?

We did face a similar problem, we wrote some code that went through all dynamic properties and created them as static properties. When the static property were created we copied the value from the dynamic property to the static property through code.

#40983
Jun 28, 2010 9:01
Vote:
 

Could it be a language issue?

#40986
Jun 28, 2010 10:05
Vote:
 

I've tried to change 2 things directly into the SQL table:

tblProperty table - changed the fkPageId to point to my new custom property page id

tblPageDefinition - changed the fkPageTypeId from null which I believe identified a dynamic property

As far as I can see the properties have moved to 'static' properties and now sit on my custom page but none of the values show.

Even through admin mode the properties show in the list on the page. Somehow I've removed the link to the property value or broken it

but cant identify how....

 

Cheers

Ben

#40988
Jun 28, 2010 10:18
Vote:
 

I would strongly recommend not to do this directly against the database. Use EPiServers API instead!

#40989
Jun 28, 2010 10:24
Vote:
 

Yeah I was coming around to that possibility. Can you advise which API as a starting point?

#40990
Jun 28, 2010 10:37
Vote:
 

EPiServer.DataAbstraction.DynamicProperty (get dynamic properties and values related to a page)
EPiServer.DataAbstraction.PageDefinition (add and save properties to a pagetype)
EPiServer.DataAbstraction.PageType (to load and save pagetypes )

I can mail you some code that might help?

 

#40991
Jun 28, 2010 11:00
Vote:
 

 

 

Thanks got your email.... :-)

#40998
Edited, Jun 28, 2010 12:50
Vote:
 

Hi,


I've got some code and I'm able to move a dynamic property to a static property but only on the same page. 2 things I'm struggling to do in the code are:

1. Delete the existing dynamic property (not required now its been converted to a static one)

2. Move the newly created static property to a new page altogether

Cheers

Ben

#41087
Jun 30, 2010 22:12
Vote:
 

1. Think you can use PageDefinition.Delete method. And the resave the pagetype, give it a try.

http://sdk.episerver.com/library/CMS5/html/Methods_T_EPiServer_DataAbstraction_PageDefinition.htm

Something like this: 

var dynamicPropDef = PageDefinition.Load(dynamicProp.PageDefinitionID);
                dynamicPropDef.Delete();
var prop = PageDefinition.Load(pageDefinitionId);                
prop.Delete();
pageType.Save();

2. Why not create the static properties at correct page from start? Otherwise you can do the same thing as you did with when copying dynamic to static. 

#41093
Jul 01, 2010 8:33
Vote:
 

Why delete the dynamic properties by code? Just delete the through the admin gui. Quicker than doing it by code maybe?

#41094
Jul 01, 2010 8:35
Vote:
 

@Per: True :)

#41095
Jul 01, 2010 8:35
Vote:
 

Hi,

1. This is true but I thought if I was going to the trouble to copy them to static why not remove at the same time and do it all in one job. WIll have a look at the exmaple code above.

2. Yes this is what I've been trying to do without success so far. I've only been able to create them on the same page todate. Maybe my explanation wasnt accurate enough.

Will persevere...........

#41149
Jul 01, 2010 17:00
Vote:
 

Hi,

I have created one Dynamic propery for SiteConfiguration of type page and i want to set it common for all pages. How and where can i set it EpiServer7.5?

Or is there any other way to set comon configuration page for all pages?

#111604
Oct 16, 2014 13:18
Vote:
 

The general approach is to create a site settings section on your StartPage type, and access the property values directly through the StartPage. You could also create the site settings in a separate page under the Root, or use a block to hold all the properties. There's many approaches you can take; it's just a matter of preference. 

My preferred method these days is a customized version of Alf Nilsson's SettingsRepository: http://talk.alfnilsson.se/2014/04/01/creating-modular-settings-with-blocks/

(As a side note: For EPiServer 7.5+ questions, please create a new thread in the EPiServer 7.5 section, instead of bringing up old EPiServer CMS 5 R2 threads.)

#111608
Oct 16, 2014 13:33
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.