C# Класс Azavea.Open.DAO.Memory.MemoryDaLayer

Data access layer implementation that simply stores objects in memory.
Наследование: Azavea.Open.DAO.Unqueryable.UnqueryableDaLayer, IDaDdlLayer
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CreateIndex ( string name, ClassMapping mapping, ICollection propertyNames ) : void

Indexes the data for faster queries. Some data sources may not support indexes (such as CSV files), in which case this should throw a NotSupportedException. If the data source supports indexes, but support for creating them is not yet implemented, this should throw a NotImplementedException.

CreateSequence ( string name ) : void

Ensures the sequence exists. NOTE: It is not necessary to call this method, as this data store creates sequences on the fly when they are first accessed.

CreateStoreHouse ( ) : void

Does nothing. This data store does not support store houses.

CreateStoreRoom ( ClassMapping mapping ) : void

Creates the store room specified in the connection descriptor. NOTE: It is not necessary to call this method, as this data store will create the store room on the fly if it does not exist.

Delete ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit ) : int

Deletes a data object record using the mapping and criteria for what's deleted.

DeleteIndex ( string name, ClassMapping mapping ) : void

Removes an index on the data for slower queries (but usually faster inserts/updates/deletes). Some data sources may not support indexes (such as CSV files), in which case this method should be a no-op. If the data source supports indexes, but support for creating them is not yet implemented, this should throw a NotImplementedException.

DeleteSequence ( string name ) : void

Removes a sequence. NOTE: This data source creates seuqences on the fly when they are accessed, so this will have the effect that the next access of the sequence will get a "1" rather than the current next value.

DeleteStoreHouse ( ) : void

Does nothing. This data store does not support store houses.

DeleteStoreRoom ( ClassMapping mapping ) : void

Deletes the store room specified in the connection descriptor. NOTE: This data store will create the store room on the fly when accessed, so this method is effectively the same as just deleting all the records.

ExecuteQuery ( ITransaction transaction, ClassMapping mapping, IDaQuery query, DataReaderDelegate invokeMe, Hashtable parameters ) : void

Executes a query and invokes a method with a DataReader of results.

GenerateClassMappingFromStoreRoom ( string storeRoomName, IComparer columnSorter ) : ClassMapping

Uses some form of introspection to determine what data is stored in this data store, and generates a ClassMapping that can be immediately used with a DictionaryDAO. As much data as practical will be populated on the ClassMapping, at a bare minimum the Table (typically set to the storeRoomName passed in, or the more correct or fully qualified version of that name), the TypeName (set to the storeRoomName, since we have no .NET type), and the "data cols" and "obj attrs" will be the list of attributes / columns in the data source, mapped to themselves.

GetCount ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit, ICollection groupExpressions ) : List

Gets a count of records for the given criteria, aggregated by the given grouping expressions. This matches "GROUP BY" behavior in SQL.

GetCount ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit ) : int

Gets a count of records for the given criteria.

GetLastAutoGeneratedId ( ITransaction transaction, ClassMapping mapping, string idCol ) : object

Finds the last generated id number for a column.

GetNextSequenceValue ( ITransaction transaction, string sequenceName ) : int

Gets the next id number from a sequence in the data source.

IndexExists ( string name, ClassMapping mapping ) : bool

Returns whether an index with this name exists or not. NOTE: This does NOT verify what properties the index is on, merely whether an index with this name is already present.

Insert ( ITransaction transaction, ClassMapping mapping, object>.IDictionary propValues ) : int

Inserts a data object record using the "table" and a list of column/value pairs.

InsertBatch ( ITransaction transaction, ClassMapping mapping, object>.List propValueDictionaries ) : void

Inserts a list of data object records of the same type.

MemoryDaLayer ( IConnectionDescriptor connDesc ) : System

Create a new memory store.

SequenceExists ( string name ) : bool

Returns whether a sequence with this name exists or not.

StoreHouseMissing ( ) : bool

Always returns false. This data store does not support store houses.

StoreRoomMissing ( ClassMapping mapping ) : bool

Always returns false. This data store will create the storeroom on the fly if it is missing.

Truncate ( ClassMapping mapping ) : void

Deletes all contents of the table. Faster for large tables than DeleteAll, but requires greater permissions. For layers that do not support this, the behavior should be the same as calling Delete(null, mapping).

Update ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit, object>.IDictionary propValues ) : int

Updates a data object record using the "table" and a list of column/value pairs.

UpdateBatch ( ITransaction transaction, ClassMapping mapping, List criteriaList, object>.List propValueDictionaries ) : void

Updates a list of data object records of the same type.

Приватные методы

Метод Описание
GetNextAutoGeneratedId ( ClassMapping mapping, string idCol ) : object

Finds the next generated id number for a column (for inserts for example).

GetTable ( ClassMapping mapping ) : MemoryObject>.IDictionary

Описание методов

CreateIndex() публичный Метод

Indexes the data for faster queries. Some data sources may not support indexes (such as CSV files), in which case this should throw a NotSupportedException. If the data source supports indexes, but support for creating them is not yet implemented, this should throw a NotImplementedException.
public CreateIndex ( string name, ClassMapping mapping, ICollection propertyNames ) : void
name string Name of the index. Some data sources require names for indexes, /// and even if not this is required so the index can be deleted if desired.
mapping ClassMapping ClassMapping for the data that is being indexed.
propertyNames ICollection Names of the data properties to include in the index (in order).
Результат void

CreateSequence() публичный Метод

Ensures the sequence exists. NOTE: It is not necessary to call this method, as this data store creates sequences on the fly when they are first accessed.
public CreateSequence ( string name ) : void
name string Name of the new sequence to create.
Результат void

CreateStoreHouse() публичный Метод

Does nothing. This data store does not support store houses.
public CreateStoreHouse ( ) : void
Результат void

CreateStoreRoom() публичный Метод

Creates the store room specified in the connection descriptor. NOTE: It is not necessary to call this method, as this data store will create the store room on the fly if it does not exist.
public CreateStoreRoom ( ClassMapping mapping ) : void
mapping ClassMapping ClassMapping for the data that will be stored in this room.
Результат void

Delete() публичный Метод

Deletes a data object record using the mapping and criteria for what's deleted.
public Delete ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit ) : int
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table from which to delete.
crit Azavea.Open.DAO.Criteria.DaoCriteria Criteria for deletion. NOTE: Only the expressions are observed, /// other things (like "order" or start / limit) are ignored. /// WARNING: A null or empty (no expression) criteria will /// delete ALL records!
Результат int

DeleteIndex() публичный Метод

Removes an index on the data for slower queries (but usually faster inserts/updates/deletes). Some data sources may not support indexes (such as CSV files), in which case this method should be a no-op. If the data source supports indexes, but support for creating them is not yet implemented, this should throw a NotImplementedException.
public DeleteIndex ( string name, ClassMapping mapping ) : void
name string Name of the index to delete.
mapping ClassMapping ClassMapping for the data that was being indexed.
Результат void

DeleteSequence() публичный Метод

Removes a sequence. NOTE: This data source creates seuqences on the fly when they are accessed, so this will have the effect that the next access of the sequence will get a "1" rather than the current next value.
public DeleteSequence ( string name ) : void
name string Name of the sequence to delete.
Результат void

DeleteStoreHouse() публичный Метод

Does nothing. This data store does not support store houses.
public DeleteStoreHouse ( ) : void
Результат void

DeleteStoreRoom() публичный Метод

Deletes the store room specified in the connection descriptor. NOTE: This data store will create the store room on the fly when accessed, so this method is effectively the same as just deleting all the records.
public DeleteStoreRoom ( ClassMapping mapping ) : void
mapping ClassMapping ClassMapping for the data that was stored in this room.
Результат void

ExecuteQuery() публичный Метод

Executes a query and invokes a method with a DataReader of results.
public ExecuteQuery ( ITransaction transaction, ClassMapping mapping, IDaQuery query, DataReaderDelegate invokeMe, Hashtable parameters ) : void
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping Class mapping for the table we're querying against. Optional, /// but not all columns may be properly typed if it is null.
query IDaQuery The query to execute, should have come from CreateQuery.
invokeMe DataReaderDelegate The method to invoke with the IDataReader results.
parameters System.Collections.Hashtable A hashtable containing any values that need to be persisted through invoked method. /// The list of objects from the query will be placed here.
Результат void

GenerateClassMappingFromStoreRoom() публичный Метод

Uses some form of introspection to determine what data is stored in this data store, and generates a ClassMapping that can be immediately used with a DictionaryDAO. As much data as practical will be populated on the ClassMapping, at a bare minimum the Table (typically set to the storeRoomName passed in, or the more correct or fully qualified version of that name), the TypeName (set to the storeRoomName, since we have no .NET type), and the "data cols" and "obj attrs" will be the list of attributes / columns in the data source, mapped to themselves.
public GenerateClassMappingFromStoreRoom ( string storeRoomName, IComparer columnSorter ) : ClassMapping
storeRoomName string The name of the storeroom (I.E. table). May be null /// if this data source does not use store rooms.
columnSorter IComparer If you wish the columns / attributes to be in a particular /// order, supply this optional parameter. May be null.
Результат ClassMapping

GetCount() публичный Метод

Gets a count of records for the given criteria, aggregated by the given grouping expressions. This matches "GROUP BY" behavior in SQL.
public GetCount ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit, ICollection groupExpressions ) : List
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table for which to build the query string.
crit Azavea.Open.DAO.Criteria.DaoCriteria The criteria to use for "where" comparisons.
groupExpressions ICollection The fields/expressions to aggregate on when counting.
Результат List

GetCount() публичный Метод

Gets a count of records for the given criteria.
public GetCount ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit ) : int
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table for which to build the query string.
crit Azavea.Open.DAO.Criteria.DaoCriteria The criteria to use for "where" comparisons.
Результат int

GetLastAutoGeneratedId() публичный Метод

Finds the last generated id number for a column.
public GetLastAutoGeneratedId ( ITransaction transaction, ClassMapping mapping, string idCol ) : object
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The class mapping for the table being queried.
idCol string The ID column for which to find the last-generated ID.
Результат object

GetNextSequenceValue() публичный Метод

Gets the next id number from a sequence in the data source.
public GetNextSequenceValue ( ITransaction transaction, string sequenceName ) : int
transaction ITransaction The transaction to do this as part of.
sequenceName string The name of the sequence.
Результат int

IndexExists() публичный Метод

Returns whether an index with this name exists or not. NOTE: This does NOT verify what properties the index is on, merely whether an index with this name is already present.
public IndexExists ( string name, ClassMapping mapping ) : bool
name string Name of the index to check for.
mapping ClassMapping ClassMapping for the data that may be indexed.
Результат bool

Insert() публичный Метод

Inserts a data object record using the "table" and a list of column/value pairs.
public Insert ( ITransaction transaction, ClassMapping mapping, object>.IDictionary propValues ) : int
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table or other data container we're dealing with.
propValues object>.IDictionary A dictionary of "column"/value pairs for the object to insert.
Результат int

InsertBatch() публичный Метод

Inserts a list of data object records of the same type.
public InsertBatch ( ITransaction transaction, ClassMapping mapping, object>.List propValueDictionaries ) : void
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table or other data container we're dealing with.
propValueDictionaries object>.List A list of dictionaries of column/value pairs. /// Each item in the list should represent the dictionary of column/value pairs for /// each respective object being inserted.
Результат void

MemoryDaLayer() публичный Метод

Create a new memory store.
public MemoryDaLayer ( IConnectionDescriptor connDesc ) : System
connDesc IConnectionDescriptor Connection descriptor to use with this layer.
Результат System

SequenceExists() публичный Метод

Returns whether a sequence with this name exists or not.
public SequenceExists ( string name ) : bool
name string Name of the sequence to check for.
Результат bool

StoreHouseMissing() публичный Метод

Always returns false. This data store does not support store houses.
public StoreHouseMissing ( ) : bool
Результат bool

StoreRoomMissing() публичный Метод

Always returns false. This data store will create the storeroom on the fly if it is missing.
public StoreRoomMissing ( ClassMapping mapping ) : bool
mapping ClassMapping
Результат bool

Truncate() публичный Метод

Deletes all contents of the table. Faster for large tables than DeleteAll, but requires greater permissions. For layers that do not support this, the behavior should be the same as calling Delete(null, mapping).
public Truncate ( ClassMapping mapping ) : void
mapping ClassMapping
Результат void

Update() публичный Метод

Updates a data object record using the "table" and a list of column/value pairs.
public Update ( ITransaction transaction, ClassMapping mapping, DaoCriteria crit, object>.IDictionary propValues ) : int
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table or other data container we're dealing with.
crit Azavea.Open.DAO.Criteria.DaoCriteria All records matching this criteria will be updated per the dictionary of /// values.
propValues object>.IDictionary A dictionary of column/value pairs for all non-ID columns to be updated.
Результат int

UpdateBatch() публичный Метод

Updates a list of data object records of the same type.
public UpdateBatch ( ITransaction transaction, ClassMapping mapping, List criteriaList, object>.List propValueDictionaries ) : void
transaction ITransaction The transaction to do this as part of.
mapping ClassMapping The mapping of the table or other data container we're dealing with.
criteriaList List A list of DaoCriteria. /// Each item in the list should represent the criteria for /// rows that will be updated per the accompanying dictionary.
propValueDictionaries object>.List A list of dictionaries of column/value pairs. /// Each item in the list should represent the dictionary of non-ID column/value pairs for /// each respective object being updated.
Результат void