2013年4月25日

摘要: using System;using System.Diagnostics;namespace ConsoleApplication23{ class Program { static void Main() { //判断网络共享目录是否可以访问 Console.WriteLine(Cmd(@"net use \\192.168.32.145\ZhaoPinPrj")); Console.ReadKey(); } static bool ... 阅读全文
posted @ 2013-04-25 14:39 HTTP500 阅读(274) 评论(0) 推荐(0) 编辑

2013年4月10日

摘要: 1、新建一个IdentityScope类,模拟域上用户using System;using System.ComponentModel;using System.Runtime.InteropServices;namespace Common{ /// <summary> /// The type of logon operation to perform. /// </summary> public enum LogonType : uint { /// <summary> /// This logon type is intende... 阅读全文
posted @ 2013-04-10 17:53 HTTP500 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 1、定义一个attribute,同时继承接口IOperationBehavior[AttributeUsage(AttributeTargets.Method)] public class RecordAttribute : Attribute, IOperationBehavior { private readonly string _operationName; private readonly RecordType _recordType; public RecordAttribute(string methodname... 阅读全文
posted @ 2013-04-10 13:22 HTTP500 阅读(351) 评论(0) 推荐(1) 编辑

2013年2月22日

摘要: using System;using System.Diagnostics;using System.Globalization;namespace ConsoleApplication18{ class Program { static void Main() { const int maxTimes = 5000; const string inputString = "2xc61"; CodeTime("TryParse", () => { for (int i = 0; i < maxTimes; i++) { int t; if ( 阅读全文
posted @ 2013-02-22 14:37 HTTP500 阅读(217) 评论(0) 推荐(0) 编辑

2013年2月21日

摘要: IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Employee_Tree]') AND type in (N'U'))DROP TABLE [dbo].[Employee_Tree]CREATE TABLE [dbo].[Employee_Tree]([Employee_NM] [nvarchar](50) NULL,[Employee_ID] [int] NOT NULL,[ReportsTo] [int] NULL)INSERT INTO Employee_ 阅读全文
posted @ 2013-02-21 16:52 HTTP500 阅读(133) 评论(0) 推荐(0) 编辑

2013年2月16日

摘要: using System;using System.Runtime.Caching; /// <summary> /// .net本地缓存 /// </summary> public class LocalCache { private static volatile MemoryCache _cache; static LocalCache() { _cache = MemoryCache.Default; } public void Set(string key, string content, DateTime expiretime) ... 阅读全文
posted @ 2013-02-16 10:30 HTTP500 阅读(357) 评论(0) 推荐(0) 编辑

2013年1月31日

摘要: dynamic与反射的性能比较,请参考:http://www.cnblogs.com/cuitsl/archive/2012/01/06/2314636.html代码如下:string cacheInstance = ConfigurationManager.AppSettings["cachedll"]; var assembly = Assembly.Load(cacheInstance); dynamic instance = assembly.CreateInstance(ConfigurationManager.AppSettings["cachecls 阅读全文
posted @ 2013-01-31 10:42 HTTP500 阅读(162) 评论(0) 推荐(0) 编辑

2013年1月26日

摘要: PARSENAME (Transact-SQL)返回对象名称的指定部分。可以检索的对象部分有对象名、所有者名称、数据库名称和服务器名称。注意PARSENAME 函数不指示指定名称的对象是否存在。PARSENAME 仅返回指定对象名称的指定部分。 语法PARSENAME ('object_name',object_piece ) 参数'object_name'要检索其指定部分的对象的名称。object_name 的数据类型为 sysname。此参数是可选的限定对象名称。如果对象名称的所有部分都是限定的,则此名称可包含四部分:服务器名称、数据库名称、所有者名称以及对 阅读全文
posted @ 2013-01-26 07:23 HTTP500 阅读(199) 评论(0) 推荐(0) 编辑

2013年1月24日

摘要: dll文件下载:http://logging.apache.org/log4net/download_log4net.cgi配置文件:<?xml version="1.0"?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> </configSections> <log4n 阅读全文
posted @ 2013-01-24 21:16 HTTP500 阅读(173) 评论(0) 推荐(0) 编辑

2013年1月9日

摘要: 笔者最近在开发一个项目中,因为各个环境中的数据库链接都不一样,如果修改了配置文件中的某一个节点的值,还要让运维重新再配置链接节点,比较麻烦,所以打算将配置文件中appSettings节点的内容拆分。使用如下方式配置:<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="test" connectionString=""/> </connecti 阅读全文
posted @ 2013-01-09 10:16 HTTP500 阅读(189) 评论(0) 推荐(0) 编辑