1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Collection reference entity

Collection reference entity

4 posts, 0 answered
  1. Vitaly
    Vitaly avatar
    11 posts
    Registered:
    20 Jun 2010
    16 Mar 2011
    Link to this post
    Hey,

    I need to extend my own main entity in Sitefinity with a collection of sub-entities (like add comments for post). So basically there should be a reference field to main entity (post_id or smth) and from the main entity I should be able to get all comments. How do I update database with sitefinity FluentAPI for that?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    16 Mar 2011
    Link to this post
    Hi Vitaly,

    You can use custom fields which you can add from the UI or programmatically. Each content object has a data expression methods - GetValue, SetValue that you can use.

    All the best,
    Ivan Dimitrov
    the Telerik team
  3. Vitaly
    Vitaly avatar
    11 posts
    Registered:
    20 Jun 2010
    16 Mar 2011
    Link to this post
    Is it intended for this purpose? I was curious what will happen in case of many comments. Also - how do I add it from UI?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Mar 2011
    Link to this post
    Hi Vitaly,

    The custom fields are related to the content object which has relation to the comments. I attached a screenshot which shows how you can add a filed from the UI. You can use the fluent api and DataExtenssion method of the content object GetValue("") to get the data entered by your custom field.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
4 posts, 0 answered