How to use my own table is Sitefinity

Posted by Community Admin on 04-Aug-2018 04:02

How to use my own table is Sitefinity

All Replies

Posted by Community Admin on 15-Jul-2016 00:00

Hi,

I have an issue to using my own table in sitefinity, for example i want to upload data by SSMS and display it in sitefinity widget or edit the data in my own table through sitefinity.
What tools should i install? what skill should i have(may be MS LINQ)? or any others requirments should i have?
Anyone can give me simple example about this?

And secondly, if i used standard sitefinty widget(for example blog widget), the posts must be stored somewhere in database, but i don't know to extract it for reporting purpose for example.

Thanks before..

Regards,

Eddy

Posted by Community Admin on 15-Jul-2016 00:00

Hi,

You need to create Dynamic Module. It will automatically create table in DB and you will be able to edit information through Sitefinity backend. And show it for visitors in fronteng with autogenerated widget for this dynamic module

You can find more useful information here: http://docs.sitefinity.com/overview-dynamic-modules-and-the-module-builder

Posted by Community Admin on 18-Jul-2016 00:00

Hi Victor,

Thanks for the explanations and suggestions, it's very useful, i am exploring it for this moment.

Regards,

Eddy

Posted by Community Admin on 25-Jul-2016 00:00

Hi Victor,

I have tried using Module Builder for creating Dynamic Module (just say: myModule), Dynamic Content Type (just say:MyType), and Dynamic Content Items, and i can see that the table structure following the structure of my Dynamic Content Type plus an additional field "BASE_ID" that defined by Sitefinity.

At this point, i can insert or edit something like a post or a transaction using Sitefinity Backend (create Content Items), and the table is reflected the changes.

But i still can not insert rows directly to my table because i dont have the GUID number for filling BASE_ID field, and my table has relation to table SF_DYNAMIC_CONTENT too.

My purpose is to insert many rows (as a master table in my application) at once.

How to achieve this?

 

Regards,

Eddy

 

 

 

 

Posted by Community Admin on 25-Jul-2016 00:00

Hi Eddy. You need to do it through sitefintiy API or webservice.

As example, you can check this article www.sitefinity.com/.../importing-data-into-custom-modules

Posted by Community Admin on 25-Jul-2016 00:00

Hi Victor,

I think this link would be a good entry point for me, thanks a lot.

Regards,

Eddy

Posted by Community Admin on 26-Jul-2016 00:00

Hi Victor,

I have a little problem when applying it.

So, when i used DynamicContent class, it seems there no SetString procedure, am I missing something?

Regards,

Eddy

 

here are my snipped codes:

using Telerik.Sitefinity.DynamicModules.Model;
...
public static void CreateStore(Store s)

   ...
   DynamicContent storeItem = dynamicModuleManager.CreateDataItem(storeType);
   
   // This is how values for the properties are set
   storeItem.SetString("Title", s.Title, cultureName);
   storeItem.SetString("Phone", s.Phone, cultureName);
   ...

 

Posted by Community Admin on 26-Jul-2016 00:00

Hi Eddy, you need to add this using:

using Telerik.Sitefinity.Model;

And i want to tell you small hint, what can help you with API

Go to Administration -> Module Builder -> Choose your module -> In the right sidebar click to "Code reference..."  

On this page you will find many code samples for your module

Posted by Community Admin on 26-Jul-2016 00:00

Hi Victor,

Ok, thanks for the enlightenments, very helpful..

Regards,

Eddy

This thread is closed