Exemplo n.º 1
0
        /// <summary>
        /// Returns the value of the specified index as the specified
        /// generic Dao type, only valid for inserts.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="index"></param>
        /// <returns></returns>
        public T ToDao <T>(int index) where T : Dao, new()
        {
            InsertResult ir = _values[index] as InsertResult;

            if (ir == null)
            {
                throw new InvalidOperationException("The specified index was not an InsertResult");
            }

            T result = (T)ir.Value;

            return(result);
        }
Exemplo n.º 2
0
 protected internal override void SubscribeToExecute()
 {
     this.Executed += (o, e) =>
     {
         IHasDataTable dt = ResultDataTables.FirstOrDefault();
         if (ResultDataTables.Count > 0)
         {
             ResultDataTables.Each((result, i) =>
             {
                 InsertResult insertResult = result as InsertResult;
                 if (insertResult != null)
                 {
                     long id = long.Parse(IdParameter.Value.ToString());
                     insertResult.Value.Property("Id", id);
                 }
                 else
                 {
                     result.SetDataTable(DataSet.Tables[i]);
                 }
             });
         }
     };
 }