/// <summary>
 /// Constructor to initialise a new provider with the business object
 /// collection provided
 /// </summary>
 /// <param name="col">The business object collection</param>
 public EditableDataSetProvider(IBusinessObjectCollection col) : base(col)
 {
     _rowChangedHandler = RowChangedHandler;
     _rowDeletedHandler = RowDeletedHandler;
     _newRowHandler = NewRowHandler;
     _boAddedHandler = BOAddedHandler;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor to initialise a new provider with the business object
 /// collection provided
 /// </summary>
 /// <param name="col">The business object collection</param>
 public EditableDataSetProvider(IBusinessObjectCollection col) : base(col)
 {
     _rowChangedHandler = RowChangedHandler;
     _rowDeletedHandler = RowDeletedHandler;
     _newRowHandler     = NewRowHandler;
     _boAddedHandler    = BOAddedHandler;
 }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// datatablenewroweventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this DataTableNewRowEventHandler datatablenewroweventhandler, Object sender, DataTableNewRowEventArgs e, AsyncCallback callback)
        {
            if (datatablenewroweventhandler == null)
            {
                throw new ArgumentNullException("datatablenewroweventhandler");
            }

            return(datatablenewroweventhandler.BeginInvoke(sender, e, callback, null));
        }
Ejemplo n.º 4
0
        public virtual void Add(T item, out T result)
        {
            DataRow newRow = null;
            DataTableNewRowEventHandler tnr = (sender, args) => newRow = args.Row;

            _dataTable.TableNewRow += tnr;
            Add(item);
            _dataTable.TableNewRow -= tnr;
            result = Hydrate(newRow);
            SaveChanges();
        }