Class WMDataSourceBase
Base class for all Data Source assets. Used by Entity Framework to store all Data Source types.
Implements
Inherited Members
Namespace: Quantellia.WMServer.Asset.DataSource
Assembly: WMServer.dll
Syntax
public class WMDataSourceBase : WMAssetBase, IWMDataSource, IWMAsset, IDbEntity, IWMEntity, IWMAssetDirectoryMember, IWMPrincipalOwned, IDisposable, IDocumentedEntity, INamedEntity, IHasEncryptedValues
Constructors
WMDataSourceBase()
Default constructor
Declaration
public WMDataSourceBase()
WMDataSourceBase(string)
Constructor that initializes the ID
Declaration
public WMDataSourceBase(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
Properties
AccessorString
The string defining how to connect to the data source (e.g. database connect string, file name, URL, etc.)
Declaration
public virtual string AccessorString { get; set; }
Property Value
Type | Description |
---|---|
string |
EncryptionPlaceholder
Standard string to replace encrypted values with when not returning plain-text values.
Declaration
[NotMapped]
public string EncryptionPlaceholder { get; set; }
Property Value
Type | Description |
---|---|
string |
InnerDataSource
Reference to the implementation-specific data source object.
Declaration
public virtual object InnerDataSource { get; set; }
Property Value
Type | Description |
---|---|
object |
RegisteredType
The string used to register this data source type in RegisterWMDataSourceType(string, Type)
Declaration
public string RegisteredType { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
CacheDataSource(string, WMDataSourceBase)
Attempts to cache the given dataSource to the memory cache.
Declaration
public static void CacheDataSource(string ID, WMDataSourceBase ds)
Parameters
Type | Name | Description |
---|---|---|
string | ID | The ID to cache under |
WMDataSourceBase | ds | The dataSource to be cached |
CommitTransaction(string)
Pushes a transaction.
Declaration
public virtual void CommitTransaction(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
Connect()
Connects to the data source provider.
Declaration
public virtual void Connect()
DeleteCacheDataSource(string)
Called whenever a WMDataSourceBase is changed. This will cause the cached model to be deleted, if it exists.
Declaration
public static void DeleteCacheDataSource(string ID)
Parameters
Type | Name | Description |
---|---|---|
string | ID | The key to search under |
DeleteData(WMPrincipal, string, List<InsertUpdateDeleteArgs>, WMAppDbContext?)
Deletes data in the data source.
Declaration
public virtual Task<ElementValue> DeleteData(WMPrincipal principal, string dir, List<InsertUpdateDeleteArgs> args, WMAppDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | dir | |
List<InsertUpdateDeleteArgs> | args | |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<ElementValue> |
Dispose()
Dispose all disposable assets.
Declaration
public virtual void Dispose()
Get(WMPrincipal, string, WMAppDbContext)
Returns a WMDataSourceBase with id
if exists, otherwise throws an exception.
Declaration
public static Task<WMDataSourceBase> Get(WMPrincipal principal, string id, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | id | The ID of the WMDataSourceBase |
WMAppDbContext | context | The context |
Returns
Type | Description |
---|---|
Task<WMDataSourceBase> |
InsertData(WMPrincipal, string, List<InsertUpdateDeleteArgs>, WMAppDbContext?)
Inserts data into the data source.
Declaration
public virtual Task<ElementValue> InsertData(WMPrincipal principal, string dir, List<InsertUpdateDeleteArgs> args, WMAppDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | dir | |
List<InsertUpdateDeleteArgs> | args | |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<ElementValue> |
OpenTransaction()
Begins a transaction
Declaration
public virtual string OpenTransaction()
Returns
Type | Description |
---|---|
string |
Read(WMDataReader, ElementValue)
Pure virtual function for reading data from this data source. Must be overridden in every child class.
Declaration
public virtual ElementValue Read(WMDataReader reader, ElementValue parameters)
Parameters
Type | Name | Description |
---|---|---|
WMDataReader | reader | |
ElementValue | parameters |
Returns
Type | Description |
---|---|
ElementValue |
RollbackTransaction(string)
Reverses all modifications made in a transaction
Declaration
public virtual void RollbackTransaction(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
TryGetCachedDataSource(string, out WMDataSourceBase)
Attempts to find and return the cached dataSource with the given ID.
Declaration
public static bool TryGetCachedDataSource(string ID, out WMDataSourceBase ds)
Parameters
Type | Name | Description |
---|---|---|
string | ID | The ID the dataSource is cached against |
WMDataSourceBase | ds | The dataSource to be returned. |
Returns
Type | Description |
---|---|
bool | True if the dataSource is found, false if not. |
UpdateData(WMPrincipal, string, List<InsertUpdateDeleteArgs>, WMAppDbContext?)
Updates data in the data source.
Declaration
public virtual Task<ElementValue> UpdateData(WMPrincipal principal, string dir, List<InsertUpdateDeleteArgs> args, WMAppDbContext? context = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | dir | |
List<InsertUpdateDeleteArgs> | args | |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task<ElementValue> |
Write(WMDataWriter, ElementValue)
Pure virtual function for Writing data from this data source. Must be overridden in every child class.
Declaration
public virtual ElementValue Write(WMDataWriter writer, ElementValue parameters = null)
Parameters
Type | Name | Description |
---|---|---|
WMDataWriter | writer | |
ElementValue | parameters |
Returns
Type | Description |
---|---|
ElementValue |