/// <summary> /// ... eventually. For now, push changes to a local file :-) /// </summary> /// <param name="event"></param> public bool Handle(SoftModelRecordEvent @event) { //try //{ // var stringToWrite = "insert {table} values (1,2,3,4,5)"; // rwl.AcquireWriterLock(timeOut); // try // { // using (var file = System.IO.File.OpenWrite("Test.txt")) // { // file.WriteAsync(UTF8Encoding.UTF8.GetBytes(stringToWrite), 0, 5).Wait(); // } // } // finally // { // rwl.ReleaseWriterLock(); // } //} //catch (ApplicationException) //{ // // TODO. Log //} return true; }
/// <summary> /// Notify of changes to the entity before save. Synchronous handlers can prevent the store operation. /// </summary> /// <param name="record"></param> /// <param name="isCreate"></param> /// <returns></returns> private bool BeforeSave(Record record, bool isCreate) { var eventType = isCreate ? EventType.BeforeCreate : EventType.BeforeUpdate; var theEvent = new SoftModelRecordEvent(eventType, record, string.Empty); return RecordEventListener.Notify<SoftModelRecordEvent>(theEvent); }