Mercurial > pub > bltoolkit
comparison HowTo/DataAccess/CommandBehavior.cs @ 0:f990fcb411a9
Копия текущей версии из github
| author | cin |
|---|---|
| date | Thu, 27 Mar 2014 21:46:09 +0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:f990fcb411a9 |
|---|---|
| 1 using System.Data; | |
| 2 | |
| 3 using NUnit.Framework; | |
| 4 | |
| 5 using BLToolkit.Data; | |
| 6 using BLToolkit.DataAccess; | |
| 7 | |
| 8 namespace HowTo.DataAccess | |
| 9 { | |
| 10 [TestFixture] | |
| 11 public class CommandBehaviorDemo | |
| 12 { | |
| 13 public abstract class TestAccessor : DataAccessor | |
| 14 { | |
| 15 [SprocName("Person_SelectAll"), /*[a]*/CommandBehavior/*[/a]*/(CommandBehavior.SchemaOnly)] | |
| 16 public abstract IDataReader SelectAllIDataReaderSchemaOnly(DbManager db); | |
| 17 } | |
| 18 | |
| 19 [Test] | |
| 20 public void Test() | |
| 21 { | |
| 22 TestAccessor ta = DataAccessor.CreateInstance<TestAccessor>(); | |
| 23 | |
| 24 using (DbManager db = ta.GetDbManager()) | |
| 25 using (IDataReader dr = ta.SelectAllIDataReaderSchemaOnly(db)) | |
| 26 { | |
| 27 DataTable table = dr.GetSchemaTable(); | |
| 28 | |
| 29 Assert.AreEqual("PersonID", table.Rows[0]["ColumnName"]); | |
| 30 Assert.AreEqual(typeof(int), table.Rows[0]["DataType"]); | |
| 31 } | |
| 32 } | |
| 33 } | |
| 34 } |
