public static DataChangedEventNotification Deserialize(Message message) { var notification = new DataChangedEventNotification(); var umsg = XDocument.Load(message.BodyStream).Descendants("umsg").First(); if (umsg != null) { notification.ApplicationName = umsg.Element("host").TryGetValue(); notification.Action = (DataManipulationOption) Enum.Parse(DataManipulationOptionType, umsg.Element("action").TryGetValue()); notification.ActionTime = DateTime.Parse(umsg.Element("actionTime").TryGetValue()); notification.ObjectId = umsg.Element("objectId").TryGetValue(); notification.TableName = umsg.Element("table").TryGetValue(); } return(notification); }
public static void Distribute(DataChangedEventNotification notification) { if (notification.ApplicationName == DbHelper.ApplicationName) { } else { switch (notification.Action) { case DataManipulationOption.Insert: break; case DataManipulationOption.Update: break; case DataManipulationOption.Delete: break; } } }
public static void Distribute(DataChangedEventNotification notification) { Console.WriteLine("notified"); }