Show / Hide Table of Contents

Class WMDataSourceBase

Base class for all Data Source assets. Used by Entity Framework to store all Data Source types.

Inheritance
object
WMAssetBase
WMDataSourceBase
WMSQLServerDataSource
Implements
IWMDataSource
IWMAsset
IDbEntity
IWMEntity
IWMAssetDirectoryMember
IWMPrincipalOwned
IDisposable
IDocumentedEntity
INamedEntity
IHasEncryptedValues
Inherited Members
WMAssetBase.ID
WMAssetBase.CreatedBy
WMAssetBase.CreatedDate
WMAssetBase.LastUpdatedBy
WMAssetBase.LastUpdatedDate
WMAssetBase.Name
WMAssetBase.Documentation
WMAssetBase.DocumentationMIMEType
WMAssetBase.Summary
WMAssetBase.ParentDirectory
WMAssetBase.FullPathName
WMAssetBase.Properties
WMAssetBase.Owner
WMAssetBase.OwnerID
WMAssetBase.OwnerType
WMAssetBase.Get<T>(WMPrincipal, string, WMAppDbContext)
WMAssetBase.GetSync<T>(string, string)
WMAssetBase.CreateFullPathName(WMAssetDirectory, string)
WMAssetBase.GetFullPath(WMPrincipal, string, string, WMAppDbContext)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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

Implements

IWMDataSource
IWMAsset
IDbEntity
IWMEntity
IWMAssetDirectoryMember
IWMPrincipalOwned
IDisposable
IDocumentedEntity
INamedEntity
IHasEncryptedValues
In this article
Back to top Copyright © 2025 Quantellia LLC.    Version 2.0.0 Revision 399     Last Updated 1/15/2025    DRAFT DOCUMENTATION. SUBJECT TO CHANGE