摘要: MVC分页源码全面兼容Bootstrapusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Web;namespace System.Web.Mvc{ public static class TKHtml { public static HtmlString Pager(this HtmlHelper htmlHelper, string url, int currentPage, int pageSize, int totalCo... 阅读全文
posted @ 2013-10-03 20:56 痛快 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 动态配置WebC.Config采用Linq string xmlPath = Server.MapPath("/web.config"); XElement rootNode = XElement.Load(xmlPath); var custs = (from c in rootNode.Elements("appSettings").Elements("add") select c).ToList(); foreach (XElement node in ... 阅读全文
posted @ 2013-10-03 12:13 痛快 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 在系统中会看到 Question/123 由来改写路由 public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Question_default", "Question/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ... 阅读全文
posted @ 2013-10-03 12:11 痛快 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 前言在代码生成器中,我们用来对数据类型和C#类型转换的映射代码实现 ... 阅读全文
posted @ 2013-08-03 14:33 痛快 阅读(217) 评论(0) 推荐(0) 编辑
摘要: public class DbHelper:DbContext { public DbHelper() : base("strConn") { //自动创建表,如果Entity有改到就更新到表结构 Database.SetInitializer(new MigrateDatabaseToLatestVersion()); } public DbSet Students { get; set; } } internal sealed class Re... 阅读全文
posted @ 2013-08-03 13:41 痛快 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 查询所有表及注释SELECT so.name , ep.[value] AS [description]FROM sysobjects so ( NOLOCK ) LEFT JOIN sys.extended_properties ep ( NOLOCK ) ON ep.major_id = so.id AND ep.minor_id = 0WHERE so.[type] = 'U'ORDER BY so.name查询表中所有字段及注释SE... 阅读全文
posted @ 2013-08-03 13:05 痛快 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 前言在开发中,我们经常使用缓存。分布式缓存使用CARP(Caching Array Routing Protocol)技术,可以产生一种高效率无接缝式的缓存,使用上让多台缓存服务器形同一台,并且不会造成数据重复存放的情况。示例代码首选引用如下DLL和依赖DLL,ServiceStack已宣称有100多位开发者在开发,我们可以借助其强大的团队来实现Cache功能 using ServiceStack.CacheAccess; using ServiceStack.CacheAccess.Azure; using ServiceStack.CacheAccess.Memcached; us... 阅读全文
posted @ 2013-08-03 11:47 痛快 阅读(565) 评论(1) 推荐(0) 编辑
摘要: IoC的好处降低耦合,提高开发效率实现代码首先加入微软示例中的两个类namespace TongKuai.IoC{ /// /// Specifies the Unity configuration for the main container. /// public class UnityConfig { #region Unity Container private static Lazy container = new Lazy(() => { var container = new Uni... 阅读全文
posted @ 2013-08-02 22:49 痛快 阅读(553) 评论(0) 推荐(0) 编辑