Class PlugInSettings
Class for handling simple plugin settings as a DataSet
Inheritance
Inherited Members
Namespace: EPiServer.PlugIn
Assembly: EPiServer.dll
Version: 11.20.7Syntax
public class PlugInSettingsRemarks
Use this class if you wish to store simple relational data and web.config or database is not an option.
Examples
  The TestSettings method below demonstrates how a plug-in could load and save
  some internal settings.
        public void TestSettings()
{
DataSet ds = Load();
DataRow row = ds.Tables[0].NewRow();
row["String"] = "The value";
ds.Tables[0].Rows.Add(row);
Save(ds);
}
private void Save(DataSet ds)
{
PlugInSettings.Save(GetType(), ds);
}
private DataSet Load()
{
DataSet ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add(new DataColumn("String", typeof(string)));
PlugInSettings.Populate(GetType(), ds);
return ds;
}Methods
AutoPopulate(Object)
Called to populate the a PlugIn's properties with user supplied values from the database.
Declaration
public static void AutoPopulate(object obj)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | obj | The instance of the PlugIn to populate | 
ChangeType(Object, Type)
This member supports the EPiServer infrastructure and is not intended to be used directly from your code.
Declaration
public static object ChangeType(object value, Type destinationType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | value | The value. | 
| System.Type | destinationType | Type of the destination. | 
Returns
| Type | Description | 
|---|---|
| System.Object | The converted object. | 
GetProperties(Type)
Gets the editable properties for the indicated plug-in type.
Declaration
public static Dictionary<PropertyInfo, PlugInPropertyAttribute> GetProperties(Type type)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | type | The plug-in type. | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.Dictionary<System.Reflection.PropertyInfo, PlugInPropertyAttribute> | A Dictionary with the plugin properties. | 
Populate(PlugInDescriptor, DataSet)
Populates the settings for the specified plug-in descriptor.
Declaration
public static void Populate(PlugInDescriptor descr, DataSet settings)Parameters
| Type | Name | Description | 
|---|---|---|
| PlugInDescriptor | descr | The descriptor. | 
| System.Data.DataSet | settings | The settings DataSet to use. | 
Remarks
This method simply PlugInDescriptor without further manipulation.
Populate(Type, DataSet)
Populate dataset with data for plugin
Declaration
public static void Populate(Type type, DataSet settings)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | type | The type of plugin | 
| System.Data.DataSet | settings | The dataset with settings to populate | 
Save(PlugInDescriptor, DataSet)
Saves the specified plug-in descriptor settings.
Declaration
public static void Save(PlugInDescriptor descr, DataSet settings)Parameters
| Type | Name | Description | 
|---|---|---|
| PlugInDescriptor | descr | The plug-in descriptor. | 
| System.Data.DataSet | settings | The settings. | 
Save(Type, DataSet)
Save dataset with settings to database
Declaration
public static void Save(Type type, DataSet settings)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | type | The type of plugin | 
| System.Data.DataSet | settings | The dataset with settings to populate | 
Events
SettingsChanged
Triggered whenever changes are made to plugin settings
Declaration
public static event EventHandler SettingsChangedEvent Type
| Type | Description | 
|---|---|
| System.EventHandler | 
Remarks
The source of the event is the PlugInDescriptor for which the changes apply, check for example ((PlugInDescriptor)source).AssemblyName to see if this event applies to your logic if needed.
