C# Class Rock.Data.DbContext

Entity Framework Context
Inheritance: System.Data.Entity.DbContext
Show file Open project: SparkDevNetwork/Rock Class Usage Examples

Public Methods

Method Description
DbContext ( ) : System

Initializes a new instance of the DbContext class.

DbContext ( string nameOrConnectionString ) : System

Initializes a new instance of the DbContext class.

SaveChanges ( ) : int

Saves all changes made in this context to the underlying database.

SaveChanges ( bool disablePrePostProcessing ) : int

Saves all changes made in this context to the underlying database. The default pre and post processing can also optionally be disabled. This would disable audit records being created, workflows being triggered, and any PreSaveChanges() methods being called for changed entities.

WrapTransaction ( System.Action action ) : void

Wraps code in a BeginTransaction and CommitTransaction

Protected Methods

Method Description
RockPostSave ( List updatedItems, PersonAlias personAlias, bool enableAuditing = false ) : void

Creates audit logs and/or triggers workflows for items that were changed

RockPreSave ( DbContext dbContext, PersonAlias personAlias, bool enableAuditing = false ) : List

Updates the Created/Modified data for any model being created or modified

Private Methods

Method Description
AuditClass ( Type baseType ) : bool
AuditProperty ( PropertyInfo propertyInfo ) : bool
GetAuditDetails ( DbContext dbContext, ContextItem item, int personAliasId ) : void
IsQualifierMatch ( ContextItem item, PropertyInfo>.Dictionary properties, WorkflowTrigger trigger ) : bool

Determines whether the entity matches the current and/or previous qualifier values. If

TriggerWorkflows ( ContextItem item, WorkflowTriggerType triggerType, PersonAlias personAlias ) : bool

Triggers all the workflows of the given triggerType for the given entity item.

Method Details

DbContext() public method

Initializes a new instance of the DbContext class.
public DbContext ( ) : System
return System

DbContext() public method

Initializes a new instance of the DbContext class.
public DbContext ( string nameOrConnectionString ) : System
nameOrConnectionString string Either the database name or a connection string.
return System

RockPostSave() protected method

Creates audit logs and/or triggers workflows for items that were changed
protected RockPostSave ( List updatedItems, PersonAlias personAlias, bool enableAuditing = false ) : void
updatedItems List The updated items.
personAlias PersonAlias The person alias.
enableAuditing bool if set to true [enable auditing].
return void

RockPreSave() protected method

Updates the Created/Modified data for any model being created or modified
protected RockPreSave ( DbContext dbContext, PersonAlias personAlias, bool enableAuditing = false ) : List
dbContext DbContext The database context.
personAlias PersonAlias The person alias.
enableAuditing bool if set to true [enable auditing].
return List

SaveChanges() public method

Saves all changes made in this context to the underlying database.
public SaveChanges ( ) : int
return int

SaveChanges() public method

Saves all changes made in this context to the underlying database. The default pre and post processing can also optionally be disabled. This would disable audit records being created, workflows being triggered, and any PreSaveChanges() methods being called for changed entities.
public SaveChanges ( bool disablePrePostProcessing ) : int
disablePrePostProcessing bool if set to true disables /// the Pre and Post processing from being run. This should only be disabled /// when updating a large number of records at a time (e.g. importing records).
return int

WrapTransaction() public method

Wraps code in a BeginTransaction and CommitTransaction
public WrapTransaction ( System.Action action ) : void
action System.Action The action.
return void