- 博客(13)
- 收藏
- 关注
转载 Web Api 模型验证
1.模型建立,在模型上类上添加System.ComponentModel.DataAnnotations验证属性 public class Product { public int Id { get; set; } [Required] public string Name { get; set; } public deci...
2016-04-07 22:34:00
200
转载 对接某款商城系统[5]商城商品多级价格处理
ProductController.cs 可以根据用户类型分别显示商品价格,可以在类中修改 \#region 商品价格 public virtual ActionResult GetDetailInfo(int id = -1, string viewName = "Detail") { YSWL.ViewModel.Shop.ProductModel model = ne...
2016-03-31 22:11:00
173
转载 利用DelegatingHandler实现Web Api 的Api key校验
客户端在请求Web Api时可以有以下两种方式提供API key 基于Querystring提供Api key http://localhost:57967/Api/Values?key=12345 基于Request header体统API key client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.A...
2016-03-31 16:50:00
160
转载 采用Lambda表达式快速实现实体模型对象转换到DTO
在项目中,采用code first时建立的模型对象不能直接用于数据传输,需要从新根据需求建立Dto对象 为什么需要建立Dto对象呢? DTO即数据传输对象。之前不明白有些框架中为什么要专门定义DTO来绑定表现层中的数据,为什么不能直接用实体模型呢,有了DTO同时还要维护DTO与Model之间的映射关系,多麻烦。 然后看了这篇文章中的讨论部分才恍然大悟。 摘两个比较有意...
2016-03-27 13:35:00
727
转载 基于DevExpress的项目窗体统一换肤
今用到DevExpress,想到换肤,参考了博友DevExpress换肤手把手教程,该文中已经实现了打开窗体换肤,但是以后打开窗体的皮肤如何设置呢,就没说了,但稍加扩展也可实现。我喜欢复杂问题简单化,在tannaiyin的基础上这么来弄 要简单得多。 第一步:添加两个引用: DevExpress.BonusSkins.v9.2 DevExpress.OfficeSkins.v9....
2009-10-26 20:14:00
309
转载 一个Linq to Sql 的关联小问题,搞死人
第一段代码 1BookDBLinqDataContextdb=newBookDBLinqDataContext(); 2 3bookbook1=newbook(); 4book1.name="book1"; 5 6BookClassb...
2009-10-07 22:12:00
118
转载 遍历进程
//下面类使用的是遍历进程,根据进程名判断 //参考 using System; using System.Text.RegularExpressions; using System.Diagnostics; using System.Runtime.InteropServices; namesp...
2008-05-09 21:39:00
131
转载 保证一个程序只运行一次
先讲实现方法: 首先依然是命名空间: using System.Threading; 然后修改 static void Main() { bool bCreatedNew; Mutex ltt =new Mutex( false, "my...
2008-05-09 21:38:00
245
转载 VC中类型转换(转载)
我们先定义一些常见类型变量借以说明#include "stdlib.h" int i = 100;long l = 2001;float f=300.2;double d=12345.119;char username[]="程佩君";char temp[200];char *buf;CString str;_variant_t v1;_bstr_t v2;一、其它数据类型转换为字符串...
2008-04-20 22:25:00
107
转载 MetaBlogApi怎么处理Inline图片?
I was curious what happened when I used the new Community Server MetaBlogAPI with inline images when posting from Live Writer. Specifically, I wanted to see how and where new folders were crea...
2006-11-30 12:47:00
135
转载 常用正则表达式[收集于网上]
"^\d+$" //非负整数(正整数+0)"^[0-9]*[1-9][0-9]*$" //正整数"^((-\d+)|(0+))$" //非正整数(负整数+0)"^-[0-9]*[1-9][0-9]*$" //负整数"^-?\d+$" //整数"^\d+(\.\d+)?$" //非负浮点数(正浮点数+0)"^(([0-9]+\.[0-9]*[1-9]...
2006-10-16 19:21:00
96
转载 CSS Friendly ASP.NET 2.0 Control Adapters (Beta 2.0)在处理URL时的一个Bug
利用CSS Friendly ASP.NET 2.0 Control Adapters (Beta 2.0)开发时例如在登陆控件,指定了CreateUserUrl="~/Secure/NewUserReg.aspx"和PasswordRecoveryUrl="~/Secure/PasswordRecovery.aspx" 1<asp:LoginID="Login1"run...
2006-10-10 13:26:00
196
转载 给所有的Control添加发送键盘事件Tab事件,实现回车键自动跳转到下一个控件[基于Shark Xu]...
在 Shark Xu 的文章给所有的Control加两个属性,实现回车键自动跳转到下一个控件 中给我们提供了一个方法实现的Windows应用程序中按回车键或者上下键,在输入项之间自动跳转。确实解决很大的问题,减少了代码量。honyoung 提出利用发送Tab事件来解决这个问题。 即简化了设置两个属性的步骤(特别是在设置下一个或上一个时选择控件时很容易出错)。同时在VS.NET中又提供了...
2006-08-25 21:50:00
303
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人