Calling Store or Retrieve Complex Objects and Lists

Topics: Core, Customizing Orchard
Mar 6, 2014 at 8:36 PM
I'm looking at creating a new ContentPart in code for Orchard 1.8. I'm trying to understand how the Store and Retrieve methods work in cases where you have complex objects and lists. For example, consider the following code:
  public class UserSuggestedEmailPart : ContentPart {
        public IReadOnlyCollection<EmailSuggestedBy> Emails {
            get { return Retrieve<IReadOnlyCollection<EmailSuggestedBy>>("Emails"); }
            set { Store("Emails", value);}
        }
    }

    public class EmailSuggestedBy {
        public string Email { get; set; }
        public int SuggestedByUserId { get; set; }
    }
I want to store a list of EmailSuggestedBy items for my UserSuggestedEmailPart. Will this code do so or is am I misunderstanding how Store and Retrieve work? If this isn't right, what should I be doing?
Coordinator
Mar 7, 2014 at 1:13 AM
Best thing right now is to handle serialization/desirialization in your accessor and provide a string representation for instance in JSon.
Developer
Mar 7, 2014 at 1:14 AM