C# Class EFRepositoryPattern.Tests.Repositories.AlternatePostRepository

Inheritance: PostRepository
Datei anzeigen Open project: hartez/EFRepositoryPattern Class Usage Examples

Public Methods

Method Description
AlternatePostRepository ( BlogContext context ) : System.Collections.Generic
Retrieve ( PostCriteria criteria = null ) : IEnumerable

Override of Retrieve that builds an explicit SQL query to do the work instead of have EF do it

This is an example to demonstrate replacing an EF-based method with a custom method. Because the Order class and the custom criteria class provide enough information, EF's generated query can be completely replaced with something else. Here it's a SQL statement that we cobble together; it could just as easily be a stored procedure or a query against a NoSQL store of some kind. You're not locked into EF or SQL Server in any way.

Method Details

AlternatePostRepository() public method

public AlternatePostRepository ( BlogContext context ) : System.Collections.Generic
context EFRepositoryPattern.Tests.Models.BlogContext
return System.Collections.Generic

Retrieve() public method

Override of Retrieve that builds an explicit SQL query to do the work instead of have EF do it
This is an example to demonstrate replacing an EF-based method with a custom method. Because the Order class and the custom criteria class provide enough information, EF's generated query can be completely replaced with something else. Here it's a SQL statement that we cobble together; it could just as easily be a stored procedure or a query against a NoSQL store of some kind. You're not locked into EF or SQL Server in any way.
public Retrieve ( PostCriteria criteria = null ) : IEnumerable
criteria PostCriteria The post criteria
return IEnumerable