.NET实现字符串base64编码
.NET实现字符串base64编码
.NET实现字符串base64编码
ServiceDescriptionImporter使用参考
CLR查找和加载程序集的方式
CountdownEvent 任务并行库使用小计
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcApplication6.Models; namespace MvcApplication6.Controllers { public class TestController : Controller { // // GET: /Test/ public ActionResult TestValidation() { return View(); } public ActionResult TestMultiValidation(IEnumerable<string> hobbies) { var list = new List<Hobby> { new Hobby{ ID="1", Name="1"}, new Hobby{ ID="2", Name="2"}, new Hobby{ ID="3", Name="3"}, new Hobby{ ID="4", Name="4"}, new Hobby{ ID="5", Name="5"} }; ViewBag.Hobbies = list; return View(list); } public ActionResult TestProc() { using (UsersContext ctx=new UsersContext()) { var param = new System.Data.SqlClient.SqlParameter { ParameterName = "@modifiedCount", SqlDbType = System.Data.SqlDbType.Int, Direction = System.Data.ParameterDirection.Output }; //var results = ctx.Database.ExecuteSqlCommand("exec dbo.proc_update @modifiedCount output", param); var results = ctx.Database.SqlQuery<Int32>("proc_update @modifiedCount output", param); var list = (int)param.Value; return Json(list, JsonRequestBehavior.AllowGet); } } } }
DROP proc proc_update go create proc proc_update @modifiedCount int output as begin update UserProfile set UserName = '112233' where UserId < 6; set @modifiedCount = @@ROWCOUNT; select @modifiedCount; end go ---执行存储过程 DECLARE @RC int set @RC = 0 exec proc_update @RC output select @RC select * from UserProfile /*DROP proc proc_update go create proc proc_update @modifiedCount int output as begin update UserProfile set UserName = '999999' where UserId < 6; set @modifiedCount = @@ROWCOUNT; return @modifiedCount; end go ---执行存储过程 DECLARE @RC int set @RC = 1 exec proc_update @RC output select @RC select * from UserProfile */
仅针对删除和修改的时候使用:在使用SqlQuery需要变通一下,将受影响行数作为查询结果
.NET Framework3.0/3.5/4.0/4.5新增功能摘要 -- 转载
监听Entity Framework生成的Sql语句
鲜为人知的 “Load Context”
使用Json.NET 实现 Linq To JSON
Json.NET 基本使用教程
Windows中的进程的Working Set,Private Bytes和Virtual Bytes