Loading

12 2012 档案

摘要:public ActionResult Edit(int id) { using (DataContext db = new DataContext(ConfigurationManager.ConnectionStrings["sqlConnection"].ConnectionString)) { IQueryable<ClassInformation> result = from c in db.GetTable<TClass>() ... 阅读全文
posted @ 2012-12-28 10:10 chear 阅读(30038) 评论(0) 推荐(1)
摘要:List<int> 转 string :list<int>: 1,2,3,4,5,6,7 转换成字符串:“1,2,3,4,5,6,7”List<int> list= new List<int>() { 1, 2, 3, 4, 5, 6, 7 };string depaid = string.Join(",", list);string 转List<int>:string s = "1, 2, 3";List<string> list = new List<string>( 阅读全文
posted @ 2012-12-22 12:32 chear 阅读(32372) 评论(1) 推荐(6)
摘要:详情请看:http://stackoverflow.com/questions/12809958/ef-how-do-i-call-savechanges-twice-inside-a-transactionusing (var transaction = new TransactionScope()){ // Do something db.SaveChanges(); // Do something else db.SaveChanges(); tramsaction.Complete();}使用上面代码会报数据库没有启用MSDTC。。------------... 阅读全文
posted @ 2012-12-18 15:29 chear 阅读(482) 评论(0) 推荐(0)
摘要:var query = (from s in ctx.Students.Include("ClassRooms") join sd in ctx.StudentDescriptions on s.StudentID equals sd.StudentID into g from stuDesc in g.DefaultIfEmpty() select new { ... 阅读全文
posted @ 2012-12-15 13:09 chear 阅读(5322) 评论(1) 推荐(1)
摘要:由于备案的问题,现在使用Nginx做代理对网站进行访问。Nginx安装到国外的服务器上(www.a.com),然后代理到国内的服务器上(aa.d.com)。发现 使用HttpContext.Current.Request.Url.Host.ToString()获取域名地址是aa.d.com。导致很多功能都链接到aa.d.com上。临时解决办法:HttpContext.Current.Request.Url.Host 直接返回Nginx上的域名地址(www.a.com)。 阅读全文
posted @ 2012-12-15 13:05 chear 阅读(1711) 评论(0) 推荐(0)