北京回龙观邮编,西陆游戏平台,qq粘虫
.net平台下兼容.net standard 2.0,一个实现以lambda表达式转转换标准sql语句,使用强类型操作数据的轻量级orm工具,在减少魔法字串同时,通过灵活的lambda表达式组合,实现业务数据查询的多样性。
create procedure [dbo].[custorderhist] @customerid nchar(5)
as
select productname, total=sum(quantity)
from products p, [order details] od, orders o, customers c
where c.customerid = @customerid
and c.customerid = o.customerid and o.orderid = od.orderid and od.productid = p.productid
group by productname
string cnstr = "data source=(local);initial catalog=northwind;user id=test;password=test";
connectionstringconnectionprovider connectionprovider = new connectionstringconnectionprovider(cnstr);
istatementexecutor target = new statementexecutor(new sqllogger(new list<isqllogwriter>() { new noopsqllogger() }), connectionprovider);
var paramdef = new parameterdefinition[]
{
new parameterdefinition
{
name = "customerid",
value = "alfki"
}
};
idatareader datareader = target.executestoredprocedure("custorderhist", paramdef);
while (datareader.read())
{
console.writeline($"productname: {datareader["productname"]},total: {datareader["total"]}");
}
alter procedure [dbo].[mytestoutparam]
( @testint int output,@teststr nvarchar(50) output )
as
begin
select @testint=100+@testint, @teststr='test out put 测试'
end
var paramdef2 = new parameterdefinition[]
{ new parameterdefinition
{ name = "@testint",
dbtype=dbtype.int32,
direction=parameterdirection.inputoutput,
value=99, },
new parameterdefinition
{ name = "@teststr",
dbtype=dbtype.string,
direction=parameterdirection.output,
size=100 }
};
var datareader2 = target.executestoredprocedure("mytestoutparam", paramdef2);
datareader2.getparametercollection(paramdef2);
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论