上一页 1 ··· 363 364 365 366 367 368 369 370 371 ··· 380 下一页
摘要: 今天有点时间,来说说如何设计的实体类更加合理,灵活,规范.首先,那要和真实数据表一一对应,必要的话,可以对类型抽象化,可以引入枚举,泛型列表等类型;其次,对实体要集成它的数据有效性的验证功能;再次,为了数据操作方便,有必要去引入数据表字段的列举集合;综上所述,我们来设计一个用户表实体;本例中的知识点为:部分类,接口规范,Flag属性的枚举,迭代器等 /// <summary> /// 数据实体统一接口 /// </summary> public interface IDataEntity { } /// <summary> /// 用户实体 /// < 阅读全文
posted @ 2011-06-30 11:49 张占岭 阅读(1203) 评论(0) 推荐(0)
摘要: 第一种,效率较高,也是很多开源项目用的方法,使用了贬型第二种,比较基础,安全性比较高,讲究面向接口的编程,我所以实体对象都继承自统一的接口 #region 数据底层操作架构一 /// <summary> /// 用户实体 /// </summary> public class User { public string UserName { get; set; } public int Age { get; set; } } public class UserRepository : IRepository<User> { #region IRepositor 阅读全文
posted @ 2011-06-29 17:17 张占岭 阅读(783) 评论(0) 推荐(0)
摘要: global它是全局访问修饰符,即所有对象都是完整路径表示例如:Console.WriteLine();完整表示法:System.Console.WriteLine("ok");那什么时候用global呢,实事上,之个关键字我们一般用的不多,只有在自定义类与系统类重名时才用的,看代码: class Program { public class System { } static void Main(string[] args) { global:: System.Console.WriteLine("ok"); } }我们看到了,program类中也有一 阅读全文
posted @ 2011-06-28 17:44 张占岭 阅读(5655) 评论(1) 推荐(1)
摘要: 1 public class ImgExtends 2 3 { 4 5 /// <summary> 6 7 /// 像本地图像文件上写字,并上传本地服务器 8 9 /// </summary> 10 11 /// <param name="imgserverurl">Web服务器上的图片路径</param> 12 13 /// <param name="title">图片上的文字</param> 14 15 /// <returns></returns>... 阅读全文
posted @ 2011-06-28 14:51 张占岭 阅读(420) 评论(0) 推荐(0)
摘要: $ 是什么?jQuery 又是什么?jQuery = window.jQuery = window.$ = function( selector, context ) { return new jQuery.fn.init( selector, context );}通过这段代码,可以看到 $,jQuery 是 window 对象上自定义的一个成员,这个成员指向了一个匿名函数,以后可以通过window 对象的 $ 或者 jQuery 来使用这个函数。这个函数返回了一个通过 jQuery.fn.init 函数定义的对象。说明通过 jQuery 得到的对象其实是一个 jQuery.fn.init 阅读全文
posted @ 2011-06-27 18:06 张占岭 阅读(656) 评论(0) 推荐(0)
上一页 1 ··· 363 364 365 366 367 368 369 370 371 ··· 380 下一页