Adding a "whitelist" setting to the SiteSettings Content Type

Topics: Administration, Core, Customizing Orchard
Sep 5, 2014 at 5:12 PM
I am trying to create a white list part for the site's settings that will allow an admin user to enter a list of urls that are considered "white listed". I'm having a problem with storing this information in the database though. When creating a new content type with information that belongs in the database you can use the following:

public class ShareBarSettingsPart : ContentPart<ShareBarSettingsPartRecord> {
public string AddThisAccount {
    get { return Record.AddThisAccount; }
    set { Record.AddThisAccount = value; } //This sets the value in the database
to set the value of AddThisAccount in the database. My problem is I need a list of urls in the database and not just a single item. I tried the following but it gives me an error:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;

namespace Speedbump.Models
public class SpeedBumpSettingsRecord : ContentPartRecord
    public virtual List<string> whiteList { get; set; }

public class SpeedBumpSettingsPart : ContentPart<SpeedBumpSettingsRecord>
    public List<string> whiteList
        get { return Record.whiteList; }
        set { Record.whiteList.Add(value); } //I need to be able to add a single record to the list here
Sep 5, 2014 at 9:11 PM
If you want to create site settings you don't need a Record. Look at SmtpSettingsPart for an example. The data will be stored in the Infoset (document db like).

But you can also simply add a custom Field to the Site content type and it will appear in the Settings.