public void TestQueryWithCommandCreators()
        {
            IDbCommandCreatorFactory ccf         = new IDbCommandCreatorFactory(adoTemplate.DbProvider, CommandType.Text, "select TestObjectNo, Age, Name from TestObjects", null);
            IDbCommandCreator        cc          = ccf.NewDbCommandCreator(null);
            IList <TestObject>       testObjects = adoTemplate.QueryWithCommandCreator(cc,
                                                                                       new TestObjectResultSetExtractor <List <TestObject> >());

            Assert.IsNotNull(testObjects);
            Assert.AreEqual(2, testObjects.Count);
            foreach (TestObject o in testObjects)
            {
                Console.WriteLine(o);
            }
        }
예제 #2
0
 /// <summary>
 /// Subclasses must implement to perform their own compilation.
 /// Invoked after this class's compilation is complete.
 /// Subclasses can assume that SQL has been supplied and that
 /// a IDbProvider has been supplied.
 /// </summary>
 protected virtual void CompileInternal()
 {
     commandFactory = new IDbCommandCreatorFactory(DbProvider, CommandType, Sql, DeclaredParameters);
     OnCompileInternal();
 }
        /// <summary>
        /// Subclasses must implement to perform their own compilation.
        /// Invoked after this class's compilation is complete.
        /// Subclasses can assume that SQL has been supplied and that
        /// a IDbProvider has been supplied.
        /// </summary>                                                                                                
        protected virtual void CompileInternal()
        {
            commandFactory = new IDbCommandCreatorFactory(DbProvider, CommandType, Sql, DeclaredParameters);
            OnCompileInternal();


        }