How can I implement complex database structure

Posted by Community Admin on 04-Aug-2018 09:15

How can I implement complex database structure

All Replies

Posted by Community Admin on 25-Nov-2011 00:00

There is a sample in the Developers Guide which shows the creation of a "product" module. This module stores information about products in the Sitefinity database using data persisting class. But I need to store information about a couple of object of different classes with relations or at least foreign keys. How can i do that?

Posted by Community Admin on 25-Nov-2011 00:00

Hi Mikhail,

We had this issue aswell, we had a locations module to build that needed to store features for a location.  I am not sure if this has changed, as typically you would look to link objects, but the way we were told to do it was via a tracked list of GUIDs, so in out LocationItem object we had:

private TrackedList<Guid> services;

[FieldAlias("services")]
 [DataMember]
 [ReadOnly(true)]
 public IList<Guid> Services
 
     get
     
         if(this.services == null)
             this.services = new TrackedList<Guid>();
         return this.services;
     
     set
     
         var pc = this.Services;
         pc.Clear();
         foreach(var id in value)
         
             pc.Add(id);
         
     
  

this allowed us to track the services (ServiceItem is another object in the model) linked to the LocationItem.

In the fluent mapping, i dont think there was anything special

locationMapping.HasAssociation(p => p.Services);

thats all i could see, and it has been a while so i dont think there is anything else.

Hope that helps a bit.

Rob

 

 

This thread is closed