游客发表

SubSonic直接执行SQL语句的方法

发帖时间:2025-11-04 13:54:51

SubSonic直接执行SQL语句的方法
复制01 public void Inline_Simple()     02 {     03     QueryCommand cmd = new InlineQuery().GetCommand("SELECT productID from products");     04     Assert.IsTrue(cmd.CommandSql ==      05             "SELECT productID from products");     06 }     07      08 public void Inline_WithCommands()     09 {     10     QueryCommand cmd = new InlineQuery()     11            .GetCommand(@"SELECT productID from products      12                WHERE productid=@productid",直接执行 1);     13      14     Assert.IsTrue(cmd.Parameters[0].ParameterName == "@productid");     15     Assert.IsTrue((int)cmd.Parameters[0].ParameterValue == 1);     16 }     17      18 public void Inline_AsCollection()     19 {     20     ProductCollection products =     21         new InlineQuery()     22             .ExecuteAsCollection<ProductCollection>(     23                       @"SELECT productID from products      24                        WHERE productid=@productid", 1);     25 }    1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.

    热门排行

    友情链接