Exemplo n.º 1
0
        }         // ExecuteEnumerable

        public virtual SafeReader GetFirst(ConnectionWrapper oConnectionToUse = null)
        {
            if (!IsReadyToGo())
            {
                throw new ArgumentOutOfRangeException("Parameters are invalid for " + GetName(), (Exception)null);
            }

            QueryParameter[] args = PrepareParameters();

            SafeReader res = DB.GetFirst(oConnectionToUse, GetName(), Species, args);

            FillOutputs(args);

            return(res);
        }         // GetFirst
Exemplo n.º 2
0
        }         // Count

        public SafeReader ToCache()
        {
            var sr = new SafeReader(null, null, false, true);

            if (ReferenceEquals(m_oRow, null) && ReferenceEquals(m_oReader, null))
            {
                return(sr);
            }

            for (int i = 0; i < Count; i++)
            {
                sr.m_oCache.Add(GetName(i), this[i]);
            }

            return(sr);
        }         // ToCache
Exemplo n.º 3
0
        }         // GetFirst

        public virtual SafeReader GetFirst(ConnectionWrapper oConnectionToUse, string sQuery, CommandSpecies nSpecies, params QueryParameter[] aryParams)
        {
            SafeReader oResult = null;

            ForEachRowSafe(
                oConnectionToUse,
                (sr, bRowsetStart) => {
                oResult = sr.ToCache();
                return(ActionResult.SkipAll);
            },
                sQuery,
                nSpecies,
                aryParams
                );

            return(oResult ?? SafeReader.CreateEmpty());
        }         // GetFirst
Exemplo n.º 4
0
        }         // ForEachResult

        public static void ForEachResult <T>(
            this DbCommand cmd,
            Func <T, ActionResult> oAction,
            Action oLogExecution = null
            ) where T : IResultRow, new()
        {
            if (ReferenceEquals(oAction, null))
            {
                throw new DbException("Callback action not specified in 'ForEachResult' call.");
            }

            Run(
                cmd,
                (oReader, bRowSetStart) => {
                var sr    = new SafeReader(oReader);
                T oResult = sr.Fill <T>();
                oResult.SetIsFirst(bRowSetStart);
                return(oAction(oResult));
            },
                oLogExecution
                );
        }         // ForEachResult
Exemplo n.º 5
0
 public SafeReaderFluentInterface(SafeReader oReader)
 {
     m_oReader = oReader;
     Reset();
 }             // constructor