Atrejoe/EFHooks — pull request #1 by kirkchen (2013-08-19 07:08:15+00:00)
Title: add current dbcontext in to HookEntityMetadata when invoke hook

I Modified Line 170
``` csharp
var metadata = new HookEntityMetadata(entityEntry.PreSaveState, this);
```
Add current dbcontext in to HookEntityMetadata when invoke hook.

So that i could do things like Instread of delete object by update field.
https://gist.github.com/kirkchen/6266387
``` csharp
///

/// IValidEntity
///

public interface IValidEntity
{
///

/// Gets or sets a value indicating whether this instance is valid.
//

///
/// true if this instance is valid; otherwise, false .
///
bool IsValid { get; set; }
}
```
```csharp
///

/// Use Valid Flag Instead of Truely Remove Object
///

public class UseValidInsteadOfDeleteHook : PreDeleteHook
{
///

/// Hooks the specified entity.
///

/// The entity.
/// The metadata.
///
public override void Hook(IValidEntity entity, HookEntityMetadata metadata)
{
entity.IsValid = false;

metadata.CurrentContext.Entry(entity).State = EntityState.Modified;
}

///

/// Gets a value indicating whether [requires validation].
///

///
/// true if [requires validation]; otherwise, false .
///
///
public override bool RequiresValidation
{
get { return false; }
}
}
```