Class ConfigDataHelper
Class that translates between name/value data dictionaries and strongly typed config data classes, as well as handling in-memory caching and on-disk persistence
Namespace: SuperOffice.ErpSync.ConnectorWS
Assembly: SuperOffice.Plugins.dll
Syntax
public static class ConfigDataHelper : Object
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.Methods
DeleteData(Guid)
Delete persisted & cached data for a given Guid
Declaration
public static void DeleteData(Guid key)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | Unique key |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.DeleteData(String)
Delete persisted & cached data for a given Guid
Declaration
public static void DeleteData(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | Unique key |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.GetData<ArgClass>(Dictionary<String, String>)
Translate data for a given key; from wire format (dictionary of name/value) to strongly typed class. Dictionary must match class exactly. This is called when Testing newly created connections.
Declaration
public static ArgClass GetData<ArgClass>(Dictionary<string, string> wireFormat)
where ArgClass : new()
Parameters
Type | Name | Description |
---|---|---|
Dictionary<String, String> | wireFormat | Dictionary of names/values to decode |
Returns
Type | Description |
---|---|
ArgClass |
Type Parameters
Name | Description |
---|---|
ArgClass | The class that contains your parameters, tagged with ConfigFieldAttribute attributes |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.GetData<ArgClass>(Guid)
Retrieve data for a given key; from cache if possible, otherwise from persistent, isolated storage
Declaration
public static ArgClass GetData<ArgClass>(Guid key)
where ArgClass : new()
Parameters
Type | Name | Description |
---|---|---|
Guid | key | Unique key |
Returns
Type | Description |
---|---|
ArgClass |
Type Parameters
Name | Description |
---|---|
ArgClass | The class that contains your parameters, tagged with ConfigFieldAttribute attributes |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.GetData<ArgClass>(String)
Retrieve data for a given key; from cache if possible, otherwise from persistent, isolated storage
Declaration
public static ArgClass GetData<ArgClass>(string key)
where ArgClass : new()
Parameters
Type | Name | Description |
---|---|---|
String | key | Unique key |
Returns
Type | Description |
---|---|
ArgClass |
Type Parameters
Name | Description |
---|---|
ArgClass | The class that contains your parameters, tagged with ConfigFieldAttribute attributes |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.GetMetaData<ArgClass>()
Get metadata for a configuration data class, ready to send to SuperOffice for display in a data-driven GUI
Declaration
public static FieldMetadataInfo[] GetMetaData<ArgClass>()
Returns
Type | Description |
---|---|
FieldMetadataInfo[] |
Type Parameters
Name | Description |
---|---|
ArgClass | The class that contains your parameters, tagged with ConfigFieldAttribute attributes |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.SaveData<ArgClass>(Guid, Dictionary<String, String>)
Save (perrsistent & cached stores) data for a given Guid
Declaration
public static void SaveData<ArgClass>(Guid key, Dictionary<string, string> data)
where ArgClass : new()
Parameters
Type | Name | Description |
---|---|---|
Guid | key | Unique key |
Dictionary<String, String> | data | Configuration data to save; must exactly match the argument class |
Type Parameters
Name | Description |
---|---|
ArgClass | The class that contains your parameters, tagged with ConfigFieldAttribute attributes |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.SaveData<ArgClass>(String, Dictionary<String, String>)
Save (perrsistent & cached stores) data for a given Guid
Declaration
public static void SaveData<ArgClass>(string key, Dictionary<string, string> data)
where ArgClass : new()
Parameters
Type | Name | Description |
---|---|---|
String | key | Unique key |
Dictionary<String, String> | data | Configuration data to save; must exactly match the argument class |
Type Parameters
Name | Description |
---|---|
ArgClass | The class that contains your parameters, tagged with ConfigFieldAttribute attributes |
Remarks
This class operates on a 'parameter class', which generally looks something like this:
public class DummyArguments
{
[ConfigField("A String", CRM.FieldMetadataTypeInfo.Text, DisplayDescription = "This is just a string")]
public string AString;
[ConfigField("A Date", CRM.FieldMetadataTypeInfo.Datetime, DisplayDescription = "This is just a date picker")]
public DateTime ADate;
[ConfigField("A Password", CRM.FieldMetadataTypeInfo.Password, DisplayDescription = "This is just a password")]
public string APassword;
[ConfigField("Mandatory Int", CRM.FieldMetadataTypeInfo.Integer, DisplayDescription = "This is just a number", Access = CRM.FieldAccessInfo.Mandatory)]
public int MandatoryInt;
[ConfigField("A Checkbox", CRM.FieldMetadataTypeInfo.Checkbox, DisplayDescription = "This is just an option")]
public int ACheckbox;
}
Data is cached in an in-memory cache, and persisted to Isolated Storage files for later retrieval. In general, name-value dictionaries with data passed in must conform exactly to the parameter class definition.
Passwords are persisted in an encrypted manner. Connection GUID to config mappings are persisted using IConfigDataStore. The default implementation writes in isolated storage per-user, per-assembly, per-domain. This means that changing the identity of the app-pool or moving to a different machine will reset all connection config values. You can create your own implementation of IConfigDataStore to replace the isolated storage with something else if you want.