Collection reference entity
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?
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
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?
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