Feature: Repository Monitor

Subscribe to be notified of database changes.
This commit is contained in:
Gary Sharp
2013-04-11 16:11:42 +10:00
parent b5531e64bd
commit 4869005c82
29 changed files with 657 additions and 216 deletions
+19
View File
@@ -68,5 +68,24 @@ namespace Disco.Data.Repository
modelBuilder.Entity<DeviceProfile>().Property(DeviceProfile.PropertyAccessExpressions.DistributionTypeDb);
}
// Hook for Repository Monitor
public override int SaveChanges()
{
int changeCount = 0;
// Notify before changes are committed
var changes = Monitor.RepositoryMonitor.BeforeSaveChanges(this);
if (changes.Length > 0)
{
changeCount = base.SaveChanges();
// Notify after changes are committed
Monitor.RepositoryMonitor.AfterSaveChanges(this, changes);
}
return changeCount;
}
}
}