Class SqlDataStore<TData>
A IDataStore<TData> using simplified SQL.
Inheritance
Inherited Members
Namespace: Cqrs.DataStores
Assembly: Cqrs.dll
Syntax
public class SqlDataStore<TData> : IDataStore<TData>, IOrderedQueryable<TData>, IQueryable<TData>, IEnumerable<TData>, IOrderedQueryable, IQueryable, IEnumerable, IDisposable where TData : Entity
Type Parameters
Name | Description |
---|---|
TData |
Constructors
SqlDataStore(IConfigurationManager, ILogger)
Instantiates a new instance of the SqlDataStore<TData> class
Declaration
public SqlDataStore(IConfigurationManager configurationManager, ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
IConfigurationManager | configurationManager | |
cdmdotnet.Logging.ILogger | logger |
Properties
ConfigurationManager
Declaration
protected IConfigurationManager ConfigurationManager { get; }
Property Value
Type | Description |
---|---|
IConfigurationManager |
DbDataContext
Gets or sets the DataContext.
Declaration
protected DataContext DbDataContext { get; }
Property Value
Type | Description |
---|---|
System.Data.Linq.DataContext |
ElementType
Gets the type of the element(s) that are returned when the expression tree associated with this instance of System.Linq.IQueryable is executed.
Declaration
public Type ElementType { get; }
Property Value
Type | Description |
---|---|
System.Type | A System.Type that represents the type of the element(s) that are returned when the expression tree associated with this object is executed. |
Implements
Expression
Gets the expression tree that is associated with the instance of System.Linq.IQueryable.
Declaration
public Expression Expression { get; }
Property Value
Type | Description |
---|---|
System.Linq.Expressions.Expression | The System.Linq.Expressions.Expression that is associated with this instance of System.Linq.IQueryable. |
Implements
Logger
Gets or sets the Logger
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ILogger |
Provider
Gets the query provider that is associated with this data source.
Declaration
public IQueryProvider Provider { get; }
Property Value
Type | Description |
---|---|
System.Linq.IQueryProvider | The System.Linq.IQueryProvider that is associated with this data source. |
Implements
Table
Gets or sets the readable Table
Declaration
protected Table<TData> Table { get; }
Property Value
Type | Description |
---|---|
System.Data.Linq.Table<TData> |
WriteableConnections
Gets or sets the list of writeable DataContexts for data mirroring
Declaration
protected IEnumerable<DataContext> WriteableConnections { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Data.Linq.DataContext> |
WriteableConnectionStrings
Gets or sets the list of writeable connection strings for data mirroring
Declaration
protected IEnumerable<string> WriteableConnectionStrings { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Methods
Add(TData)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
Add(IEnumerable<TData>)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(IEnumerable<TData> data)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TData> | data |
Implements
CreateDbDataContext()
Locate the connection settings and create a System.Data.Linq.DataContext.
Declaration
protected virtual DataContext CreateDbDataContext()
Returns
Type | Description |
---|---|
System.Data.Linq.DataContext |
Destroy(TData)
Remove the provided data
(normally by Rsn) from the data store and persist the change.
Declaration
public void Destroy(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Implements
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<TData> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<TData> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
Implements
GetWriteableConnectionStrings()
Locate the connection settings for persisting data.
Declaration
protected virtual IEnumerable<string> GetWriteableConnectionStrings()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Remove(TData)
Will mark the data
as logically (or soft) deleted by setting IsLogicallyDeleted to true in the data store and persist the change.
Declaration
public virtual void Remove(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
RemoveAll()
Remove all contents (normally by use of a truncate operation) from the data store and persist the change.
Declaration
public virtual void RemoveAll()
Implements
Update(TData)
Update the provided data
in the data store and persist the change.
Declaration
public virtual void Update(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |