Repository Managers (Data Technology Specific)
Each different type of LINQ provider implementation (Entity Framework, LINQ to SQL, CRM 4 Advanced Developer extensions) have their own base repository manager implementation. These classes are abstract classes, but they implement core abstract classes and interfaces. These classes encapsulate and implement their specific LINQ provider data operations.

Concrete Repository Implementation
Concrete repositories are specific to a data object. All underlying functionality is inherited and can be overriden. The implementation of a repository is meant to be light and yet flexible.

Retrieve Data
In a concrete repository implementation, data retrieval is specified by the following three methods: RetrieveSingle(searchValue), RetrieveMultiple, RetrieveMultiple(searchValue) (not actual syntax). Traditionally, these data retrieval methods would contain LINQ queuries which would define how the data is retrieved.

Data retrieval can also be done with the Retrieve method of the underlying abstract class. Ex: EntityRespositoryManager.Retrieve (not atual syntax).

Insert and Update
Adding and updating data is handled by the Save method of the underlying repository abstract class. The underlying base abstract class determines the state of the data object at the time of insert/update and this implementation varies across different technologies. Because of this reason, the Save method can explicitly be specified by using the SaveMethod enumeration.

The base repository manager also has a static method which allows a data object to be saved.

Deletion is handled by the Delete method of the base repository manager.

The base repository manager also has a static method which allows a data object to be saved.

There may be times when something will need to be done to the data object before the the core operation (create, update, delete) takes place. This framework provides support for this in the form of PreCreate, PreUpdate, PreDelete methods. These are implemented in the concrete repositories.

Events such as OnCreating, OnUpdating, OnDeleting, OnCreated, OnUpdated, OnDeleted provide additional data object access after such events have occurred.

Object Disposal
The base repository managers implement the IDisposable interface and automatically dispose the underlying data context.

Context Reusal
Classes such as EntityExecutionContext allow a single instance of the underlying data context to be utilized with any subsuquent repository manager calls.

Context Deferral
In some situations, all operations made to the underlying context would need to be deferred and pushed to the data store at once. Classes such as EntityContextDeferrer allow all changes to be saved right before the call to Dispose.

Last edited Jan 18, 2012 at 7:36 PM by darkjedi, version 3


No comments yet.