Class DataContextCache
A basic implementation of a data context cache.
Implements
Inherited Members
Namespace: Kephas.Data.Caching
Assembly: Kephas.Data.dll
Syntax
public class DataContextCache : IDataContextCache, IDictionary<object, IEntityEntry>, ICollection<KeyValuePair<object, IEntityEntry>>, IEnumerable<KeyValuePair<object, IEntityEntry>>, IEnumerable
Constructors
| Improve this Doc View SourceDataContextCache()
Initializes a new instance of the DataContextCache class.
Declaration
public DataContextCache()
DataContextCache(IDictionary<Object, IEntityEntry>, IDictionary<Object, IEntityEntry>)
Initializes a new instance of the DataContextCache class.
Declaration
protected DataContextCache(IDictionary<object, IEntityEntry> items, IDictionary<object, IEntityEntry> entityEntryMappings)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.Object, IEntityEntry> | items | The items. |
System.Collections.Generic.IDictionary<System.Object, IEntityEntry> | entityEntryMappings | The entity entry mappings. |
Properties
| Improve this Doc View SourceCount
Gets the number of elements contained in the System.Collections.Generic.ICollection<T>.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of elements contained in the System.Collections.Generic.ICollection<T>. |
Item[Object]
Gets or sets the element with the specified key.
Declaration
public IEntityEntry this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key of the element to get or set. |
Property Value
Type | Description |
---|---|
IEntityEntry | The element with the specified key. |
Keys
Gets an System.Collections.Generic.ICollection<T> containing the keys of the System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
public ICollection<object> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<System.Object> | An System.Collections.Generic.ICollection<T> containing the keys of the object that implements System.Collections.Generic.IDictionary<TKey, TValue>. |
Values
Gets an System.Collections.Generic.ICollection<T> containing the values in the System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
public ICollection<IEntityEntry> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<IEntityEntry> | An System.Collections.Generic.ICollection<T> containing the values in the object that implements System.Collections.Generic.IDictionary<TKey, TValue>. |
Methods
| Improve this Doc View SourceAdd(IEntityEntry)
Adds an IEntityEntry to the IDataContextCache.
Declaration
public virtual void Add(IEntityEntry value)
Parameters
Type | Name | Description |
---|---|---|
IEntityEntry | value | The object to add. |
Clear()
Removes all items from the System.Collections.Generic.ICollection<T>.
Declaration
public virtual void Clear()
ContainsKey(Object)
Determines whether the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key.
Declaration
public virtual bool ContainsKey(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key to locate in the System.Collections.Generic.IDictionary<TKey, TValue>. |
Returns
Type | Description |
---|---|
System.Boolean |
|
CopyTo(KeyValuePair<Object, IEntityEntry>[], Int32)
Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.
Declaration
public void CopyTo(KeyValuePair<object, IEntityEntry>[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Object, IEntityEntry>[] | array | The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing. |
System.Int32 | arrayIndex | The zero-based index in |
GetEntityEntry(Object)
Gets the entity entry associated to the provided entity, or null
if none could be found.
Declaration
public virtual IEntityEntry GetEntityEntry(object entity)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entity. |
Returns
Type | Description |
---|---|
IEntityEntry | The entity entry or |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<KeyValuePair<object, IEntityEntry>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.Object, IEntityEntry>> | An enumerator that can be used to iterate through the collection. |
Remove(IEntityEntry)
Removes an IEntityEntry from the IDataContextCache.
Declaration
public virtual bool Remove(IEntityEntry value)
Parameters
Type | Name | Description |
---|---|---|
IEntityEntry | value | The object to remove. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remove(Object)
Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
public bool Remove(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key of the element to remove. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryGetValue(Object, out IEntityEntry)
Gets the value associated with the specified key.
Declaration
public virtual bool TryGetValue(object key, out IEntityEntry value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The key whose value to get. |
IEntityEntry | value | When this method returns, the value associated with the specified
key, if the key is found; otherwise, the default value for the type of
the |
Returns
Type | Description |
---|---|
System.Boolean |
|
Explicit Interface Implementations
| Improve this Doc View SourceICollection<KeyValuePair<Object, IEntityEntry>>.Add(KeyValuePair<Object, IEntityEntry>)
Adds an item to the System.Collections.Generic.ICollection<T>.
Declaration
void ICollection<KeyValuePair<object, IEntityEntry>>.Add(KeyValuePair<object, IEntityEntry> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Object, IEntityEntry> | item | The object to add to the System.Collections.Generic.ICollection<T>. |
ICollection<KeyValuePair<Object, IEntityEntry>>.Contains(KeyValuePair<Object, IEntityEntry>)
Determines whether the System.Collections.Generic.ICollection<T> contains a specific value.
Declaration
bool ICollection<KeyValuePair<object, IEntityEntry>>.Contains(KeyValuePair<object, IEntityEntry> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Object, IEntityEntry> | item | The object to locate in the System.Collections.Generic.ICollection<T>. |
Returns
Type | Description |
---|---|
System.Boolean |
|
ICollection<KeyValuePair<Object, IEntityEntry>>.IsReadOnly
Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read-only.
Declaration
bool ICollection<KeyValuePair<object, IEntityEntry>>.IsReadOnly { get; }
Returns
Type | Description |
---|---|
System.Boolean |
|
ICollection<KeyValuePair<Object, IEntityEntry>>.Remove(KeyValuePair<Object, IEntityEntry>)
Removes the first occurrence of a specific object from the System.Collections.Generic.ICollection<T>.
Declaration
bool ICollection<KeyValuePair<object, IEntityEntry>>.Remove(KeyValuePair<object, IEntityEntry> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Object, IEntityEntry> | item | The object to remove from the System.Collections.Generic.ICollection<T>. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IDictionary<Object, IEntityEntry>.Add(Object, IEntityEntry)
Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey, TValue>.
Declaration
void IDictionary<object, IEntityEntry>.Add(object key, IEntityEntry value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The object to use as the key of the element to add. |
IEntityEntry | value | The object to use as the value of the element to add. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException | An element with the same key already exists in the System.Collections.Generic.IDictionary<TKey, TValue>. |
System.NotSupportedException | The System.Collections.Generic.IDictionary<TKey, TValue> is read-only. |
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. |