Class SettingInfo
Encapsulates data for a setting item.
Implements
Namespace: Sartorius.SAF.Settings
Assembly: Sartorius.SAF.dll
Syntax
[Serializable]
public class SettingInfo : ISerializable
Constructors
View SourceSettingInfo(SettingScope)
Creates a new instance of the SettingInfo class for the specified SettingScope.
Declaration
public SettingInfo(SettingScope scope)
Parameters
| Type | Name | Description |
|---|---|---|
| SettingScope | scope | The SettingScope. |
SettingInfo(SerializationInfo, StreamingContext)
Creates a new instance of the SettingInfo class from the specified serialization info.
Declaration
protected SettingInfo(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializationInfo | info | The SerializationInfo. |
| StreamingContext | context | The StreamingContext. |
Properties
View SourceApplication
Gets the name of the application.
Declaration
public string Application { get; }
Property Value
| Type | Description |
|---|---|
| string |
ContentBinary
Gets or sets the content as binary blob.
Declaration
public byte[] ContentBinary { get; set; }
Property Value
| Type | Description |
|---|---|
| byte[] |
CustomSerializationBinder
Gets or sets the custom serialization binder.
Declaration
public SerializationBinder CustomSerializationBinder { get; set; }
Property Value
| Type | Description |
|---|---|
| SerializationBinder | The custom serialization binder. |
Scope
Gets the scope of the setting.
Declaration
public SettingScope Scope { get; }
Property Value
| Type | Description |
|---|---|
| SettingScope |
SettingId
Gets or sets the id of the setting item.
Declaration
public string SettingId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
User
Gets or sets the user name.
Declaration
public string User { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceGetContent<T>()
Gets the content as the specified type.
Declaration
public T GetContent<T>() where T : class
Returns
| Type | Description |
|---|---|
| T | The settings content as the specified type or |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the content. |
Remarks
This method does not throw a deserialization exception if the content cannot be deserialized (e.g due to a version mismatch). This is required for app settings compatibility . In some cases the new version of an application doesn't support the types that were used in a previous version or the type was changed and is no longer binary compatible for deserialization. (e.g extended with new members).
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo with the data needed to serialize the target object.
Declaration
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializationInfo | info | The SerializationInfo to populate with data. |
| StreamingContext | context | The destination (see StreamingContext) for this serialization. |
Exceptions
| Type | Condition |
|---|---|
| SecurityException | The caller does not have the required permission. |
SetContent(object)
Sets the content of the setting item.
Declaration
public void SetContent(object content)
Parameters
| Type | Name | Description |
|---|---|---|
| object | content | The content of the setting. |
Remarks
In case of a serialization exception for content of type of Dictionary(string,object) try to remove the items that cannot be serialized. See also the remarks for GetContent<T>().