Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Adding fields in an existing Dynamic Data Store

Vote:
 

I have an existing Dynamic Data Store "UserPetStore" and I have a class UserPet.cs which populates this store.

 

Whenever I add a new field in UserPet.cs. I always have to recreate the UserPetStore to get it populated properly.

Is this the expected behaviour? This is not ok especially on a live site.

 

Do I need to modfiy a mapping table or something?

 

Thanks.

#52338
Jul 19, 2011 8:43
Vote:
 

You can add the [EPiServerDataStore(AutomaticallyRemapStore = true)] attribute to UserPet.cs class declaration. The next time you access UserPet it'll automatically remap everything for you.

private static DynamicDataStore Store
        {
            get
            {
                return DynamicDataStoreFactory.Instance.GetCreateEnsureStore(typeof(UserPet));
            }
        }

Frederik  

#52341
Edited, Jul 19, 2011 10:11
Vote:
 

Cool! Thanks Frederik!

#52359
Jul 20, 2011 1:12
Vote:
 

Sorry Jan, the code above is not the correct one. Should be:

private static DynamicDataStore Store
{
    get
    {
        return typeof(UserPet).GetOrCreateStore();
    }
}

    

See CMS 6 R2 Dynamic Data Store: How to use the new store creation and rempping functionality for more.

Frederik

#52364
Jul 20, 2011 8:32
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.