Пример #1
0
        public bool TryGetEventRows(XElement root, out IReadOnlyList <Row> rows, out RowChangeKind eventType)
        {
            if (Enum.TryParse(root.Name.LocalName, out eventType) == false)
            {
                rows = new List <Row>(0);
                return(false);
            }

            List <Row> rowsReturn = new List <Row>();

            foreach (var rowElement in root.Descendants("row"))
            {
                var row = new Row(this);
                foreach (var columnElement in rowElement.Elements())
                {
                    int id = ColumnNamesLookup[columnElement.Name.LocalName];
                    if (columnElement.Attribute(XName.Get("nil", "http://www.w3.org/2001/XMLSchema-instance")) != null)
                    {
                        row[id] = null;
                    }
                    else
                    {
                        row[id] = Convert.ChangeType(columnElement.Value, ColumnTypes[id]);
                    }
                }
                rowsReturn.Add(row);
            }
            rows = rowsReturn;
            return(true);
        }
 /// <summary>
 /// Creates a new instance of <see cref="TableDataChangedEventArgs"/>
 /// </summary>
 /// <param name="rows">The rows affected</param>
 /// <param name="changeKind">Kind of change that created the event</param>
 public TableDataChangedEventArgs(IReadOnlyList <Row> rows, RowChangeKind changeKind)
 {
     ChangeKind = changeKind;
     Rows       = rows;
 }