Highway Framework  Release 1.0.1.0
The fastest and smoothest way to great architecture
 All Classes Namespaces Functions Variables Properties Events
Public Member Functions | Protected Member Functions | Properties | Events
Highway.Data.ObjectDataContext Class Reference

The default implementation of a Object context for the database first approach to Entity Framework More...

Inheritance diagram for Highway.Data.ObjectDataContext:
Highway.Data.Interfaces.IObservableDataContext Highway.Data.Interfaces.IDataContext

List of all members.

Public Member Functions

 ObjectDataContext (EntityConnection connection)
 Creates a database or model first context ///
 ObjectDataContext (string connectionString)
 Creates a database or model first context
IQueryable< T > AsQueryable< T > ()
 This gives a mockable wrapper around the normal SetT method that allows for testablity
Add< T > (T item)
 Adds the provided instance of T to the data context
Remove< T > (T item)
 Removes the provided instance of T from the data context
Update< T > (T item)
 Updates the provided instance of T in the data context
Attach< T > (T item)
 Attaches the provided instance of T to the data context
Detach< T > (T item)
 Detaches the provided instance of T from the data context
Reload< T > (T item)
 Reloads the provided instance of T from the database
int Commit ()
 Commits all currently tracked entity changes
IEnumerable< T > ExecuteSqlQuery< T > (string sql, params DbParameter[] dbParams)
 Executes a SQL command and tries to map the returned datasets into an IEnumerable{T} The results should have the same column names as the Entity Type has properties
int ExecuteSqlCommand (string sql, params DbParameter[] dbParams)
 Executes a SQL command and returns the standard int return from the query

Protected Member Functions

 ObjectDataContext (string connectionString, string defaultContainerName)
 Creates a database or model first context
 ObjectDataContext (EntityConnection connection, string defaultContainerName)
 Creates a database or model first context

Properties

IEventManager EventManager [get, set]
 The reference to EventManager that allows for ordered event handling and registration

Events

EventHandler< PreSaveEventArgsPreSave
 The event fired just before the commit of the ORM
EventHandler< PostSaveEventArgsPostSave
 The event fired just after the commit of the ORM
- Events inherited from Highway.Data.Interfaces.IObservableDataContext

Detailed Description

The default implementation of a Object context for the database first approach to Entity Framework


Constructor & Destructor Documentation

Highway.Data.ObjectDataContext.ObjectDataContext ( EntityConnection  connection)
inline

Creates a database or model first context ///

Parameters:
connection
Highway.Data.ObjectDataContext.ObjectDataContext ( string  connectionString)
inline

Creates a database or model first context

Parameters:
connectionString
Highway.Data.ObjectDataContext.ObjectDataContext ( string  connectionString,
string  defaultContainerName 
)
inlineprotected

Creates a database or model first context

Parameters:
connectionString
defaultContainerName
Highway.Data.ObjectDataContext.ObjectDataContext ( EntityConnection  connection,
string  defaultContainerName 
)
inlineprotected

Creates a database or model first context

Parameters:
connection
defaultContainerName

Member Function Documentation

T Highway.Data.ObjectDataContext.Add< T > ( item)
inline

Adds the provided instance of T to the data context

Template Parameters:
TThe Entity Type being added
Parameters:
itemThe T you want to add
Returns:
The T you added

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 
IQueryable<T> Highway.Data.ObjectDataContext.AsQueryable< T > ( )
inline

This gives a mockable wrapper around the normal SetT method that allows for testablity

Template Parameters:
TThe Entity being queried
Returns:
IQueryable{T}

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 
T Highway.Data.ObjectDataContext.Attach< T > ( item)
inline

Attaches the provided instance of T to the data context

Template Parameters:
TThe Entity Type being attached
Parameters:
itemThe T you want to attach
Returns:
The T you attached

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 
int Highway.Data.ObjectDataContext.Commit ( )
inline

Commits all currently tracked entity changes

Returns:
the number of rows affected

Implements Highway.Data.Interfaces.IDataContext.

T Highway.Data.ObjectDataContext.Detach< T > ( item)
inline

Detaches the provided instance of T from the data context

Template Parameters:
TThe Entity Type being detached
Parameters:
itemThe T you want to detach
Returns:
The T you detached

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 
int Highway.Data.ObjectDataContext.ExecuteSqlCommand ( string  sql,
params DbParameter[]  dbParams 
)
inline

Executes a SQL command and returns the standard int return from the query

Parameters:
sqlThe Sql Statement
dbParamsA List of Database Parameters for the Query
Returns:
The rows affected

Implements Highway.Data.Interfaces.IDataContext.

IEnumerable<T> Highway.Data.ObjectDataContext.ExecuteSqlQuery< T > ( string  sql,
params DbParameter[]  dbParams 
)
inline

Executes a SQL command and tries to map the returned datasets into an IEnumerable{T} The results should have the same column names as the Entity Type has properties

Template Parameters:
TThe Entity Type that the return should be mapped to
Parameters:
sqlThe Sql Statement
dbParamsA List of Database Parameters for the Query
Returns:
An IEnumerable{T} from the query return

Implements Highway.Data.Interfaces.IDataContext.

T Highway.Data.ObjectDataContext.Reload< T > ( item)
inline

Reloads the provided instance of T from the database

Template Parameters:
TThe Entity Type being reloaded
Parameters:
itemThe T you want to reload
Returns:
The T you reloaded

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 
T Highway.Data.ObjectDataContext.Remove< T > ( item)
inline

Removes the provided instance of T from the data context

Template Parameters:
TThe Entity Type being removed
Parameters:
itemThe T you want to remove
Returns:
The T you removed

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 
T Highway.Data.ObjectDataContext.Update< T > ( item)
inline

Updates the provided instance of T in the data context

Template Parameters:
TThe Entity Type being updated
Parameters:
itemThe T you want to update
Returns:
The T you updated

Implements Highway.Data.Interfaces.IDataContext.

Type Constraints
T :class 

Property Documentation

IEventManager Highway.Data.ObjectDataContext.EventManager
getset

The reference to EventManager that allows for ordered event handling and registration

Implements Highway.Data.Interfaces.IDataContext.


Event Documentation

EventHandler<PostSaveEventArgs> Highway.Data.ObjectDataContext.PostSave

The event fired just after the commit of the ORM

Implements Highway.Data.Interfaces.IObservableDataContext.

EventHandler<PreSaveEventArgs> Highway.Data.ObjectDataContext.PreSave

The event fired just before the commit of the ORM

Implements Highway.Data.Interfaces.IObservableDataContext.


The documentation for this class was generated from the following file: