Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ public enum NotificationTypes
public class TableChangedEventArgs : EventArgs
{
private readonly string notificationMessage;
private readonly string tableNameWithShema;

private const string INSERTED_TAG = "inserted";

private const string DELETED_TAG = "deleted";

public TableChangedEventArgs(string notificationMessage)
public TableChangedEventArgs(string notificationMessage,string tableNameWithShema)
{
this.notificationMessage = notificationMessage;
this.tableNameWithShema = tableNameWithShema;
}

public XElement Data
Expand All @@ -42,7 +44,7 @@ public XElement Data
{
if (string.IsNullOrWhiteSpace(notificationMessage)) return null;

return ReadXDocumentWithInvalidCharacters(notificationMessage);
return ReadXDocumentWithInvalidCharacters(notificationMessage, tableNameWithShema);
}
}

Expand All @@ -66,11 +68,11 @@ public NotificationTypes NotificationType
/// </summary>
/// <param name="xml">The input string.</param>
/// <returns>The result XElement.</returns>
private static XElement ReadXDocumentWithInvalidCharacters(string xml)
private static XElement ReadXDocumentWithInvalidCharacters(string xml,string tblName)
{
XDocument xDocument = null;

XmlReaderSettings xmlReaderSettings = new XmlReaderSettings {CheckCharacters = false};
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { CheckCharacters = false };

using (var stream = new StringReader(xml))
using (XmlReader xmlReader = XmlReader.Create(stream, xmlReaderSettings))
Expand All @@ -80,6 +82,8 @@ private static XElement ReadXDocumentWithInvalidCharacters(string xml)
xDocument = XDocument.Load(xmlReader);
}

xDocument.Root.Add(new XDocument("Table",tblName));

return xDocument.Root;
}
}
Expand Down Expand Up @@ -778,10 +782,11 @@ private void InstallNotification()

private void OnTableChanged(string message)
{
var tblWithShem = SchemaName + "." + TableName;
var evnt = this.TableChanged;
if (evnt == null) return;

evnt.Invoke(this, new TableChangedEventArgs(message));
evnt.Invoke(this, new TableChangedEventArgs(message, tblWithShem));
}

private void OnNotificationProcessStopped()
Expand Down