Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Can not create a complete sample code but I think this will help you. Below link is for Creating table
https://github.com/Geta/404handler/blob/master/src/Core/Upgrade/Upgrader.cs
And, below link is for interaction with database
https://github.com/Geta/404handler/blob/master/src/Core/Data/DataAccessBaseEx.cs
Hope, you will have a good direction with above examples. Let me know if you need any more help.
Thanks,
Praful Jangid
Just to throw another option into the mix, if you're storing favourites against a logged in user, you could use the user's profile to store the data. Setup is simple - just add the required field into your config like this (where I've added Favourites as a list of integers):
<profile defaultProvider="DefaultProfileProvider">
<properties>
<add name="Address" type="System.String" />
<add name="ZipCode" type="System.String" />
<add name="Locality" type="System.String" />
<add name="Email" type="System.String" />
<add name="FirstName" type="System.String" />
<add name="LastName" type="System.String" />
<add name="Language" type="System.String" />
<add name="Country" type="System.String" />
<add name="Company" type="System.String" />
<add name="Title" type="System.String" />
<add name="CustomExplorerTreePanel" type="System.String" />
<add name="FileManagerFavourites" type="System.Collections.Generic.List`1[System.String]" />
<add name="EditTreeSettings" type="EPiServer.Personalization.GuiSettings, EPiServer.Cms.AspNet" />
<add name="ClientToolsActivationKey" type="System.String" />
<add name="FrameworkName" type="System.String" />
<add name="Favourites" type="System.Collections.Generic.List`1[System.Int32]" />
</properties>
</profile>
You can then access, modify and save the data like this:
var profile = EPiServerProfile.Current;
var favourites = (profile["Favourites"] as List<Int32>) ?? new List<Int32>();
if (!favourites.Contains(currentPage.ContentLink.ID))
{
favourites.Add(currentPage.ContentLink.ID);
}
profile.Save();
Hello,
I have a requirement to implement bookmarks feature in EpiServer. So when a user logs in, he could mark a content as favorite.
I will be storing userid and corresponding content id in a table. Assuming this will require me to create a new table in EPiServer database (not creating new database here since only one table)
Also when user logs in, I will be quering agains this DB table to fetch all content ids and load those content for user to view.
Can some one guide me on how to proceed on Database interaction in EpiServer and any best practices or reference links. I have seen link in this forum that talks about this feature already so if anyone can post some details that would be helpful.