小马

现在是零将来是无限

导航

随笔分类 -  .NET

Anything about the .NET Platform and Programming languages.
在ASP.NET web 站点中使用log4net (1.2.9)
摘要:关于log4net的介绍请参考 http://logging.apache.org/log4net/ 在ASP.NET web 站点中使用log4net(独立的配置文件)的步骤和注意事项:1 添加log4net.dll的引用2.创建/log4net.config(名字可自定义)文件,其内容请参考 log4net 网站 log4net Manual - Configuration 部分3.修改glo... 阅读全文

posted @ 2006-04-14 14:56 mahope 阅读(2599) 评论(2) 推荐(0)

在.NET 中实现 AOP
摘要:软件工程中的大多数思想都是集中在管理复杂度上面的--结构化编程尝试通过粗粒度的代码与设计划分来降低复杂度;面向对象编程尝试通过建立结合状态与行为的抽象体来降低复杂度;基于组件的软件尝试通过基于抽象接口和协议划分应用程序模块来降低复杂度。基于组件的软件的梦想是构造一个世界,让水平一般的程序员就能使用高级语言和工具将组件组装起来。这当然假设这个世界里面的问题域能被分解成相互之间通过简单的方法调用进行交... 阅读全文

posted @ 2006-03-29 01:00 mahope 阅读(568) 评论(0) 推荐(0)

解决Web Service中传递子类实例时,序列化的问题。
摘要:首先,无论如何传递一个子类的实例是无法解决问题的。其次,好像没有什么现成的方法能直接从子类的实例中创造出父类的实例来。我曾经尝试返回base,但是失败了。于是,迫不得已,我只有通过反射来将子类对象的数据传递到父类对象去。代码如下:publicclassDerivedType:WS.BaseType,System.ICloneable{publicWS.BaseTypeClone(){WS.Base... 阅读全文

posted @ 2006-03-26 01:36 mahope 阅读(570) 评论(0) 推荐(0)

Q & A:Does ASP.NET support one-way Web Service operations?
摘要:Q Does ASP.NET support one-way Web Service operations?A Yes, you can implement one-way operations in ASP.NET by setting the OneWay property of the SoapDocumentMethod attribute to true, as shown here:[... 阅读全文

posted @ 2006-03-25 13:37 mahope 阅读(448) 评论(0) 推荐(0)

删除everyone对c:的 访问权限后,运行asp.net出现DirectoryNotFoundException未找到路径“C:\”的一部分
摘要:未找到路径“C:\”的一部分。说明:执行当前Web请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息:System.IO.DirectoryNotFoundException:未找到路径“C:\”的一部分。源错误:执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确... 阅读全文

posted @ 2005-12-19 16:02 mahope 阅读(2311) 评论(0) 推荐(0)

NHibernate Mapping文件中如何指定类的字节数组属性
摘要:对于字节数组类型的属性映射,可以用Byte[]指定其Type,但是这中类型只能保存8000个字节(虽然你可以指定超过8000的Length属性,而且生成的表字段类型也为Image)。 如果要保存任意长的字节数据,需要用到BinaryBlob类型。 举个例子,如果Employee类有一Photo属性为字节数组: public class Employee { //其他略去 public by... 阅读全文

posted @ 2005-12-09 00:48 mahope 阅读(1577) 评论(1) 推荐(0)

NHibernate.ADOException : Unable to perform find
摘要:在NHibernate的 mapping xml 文件中有些字段加了方括号引起来后,会引起错误xxx.Framework.TestCase.TestNHibernate : NHibernate.ADOException : Unable to perform find ----> System.IndexOutOfRangeException : [TargetID0_] ... 阅读全文

posted @ 2005-11-28 22:28 mahope 阅读(1191) 评论(0) 推荐(0)

对于事件不能调用BeginInvoke,可改用另外一层包装
摘要:事件类型: 错误事件来源: WISP CmppRelay事件种类: 无事件 ID: 38日期: 2005-11-28事件: 18:54:45用户: N/A计算机: SERVER1描述:调用类"Sinosky.Cmpp.CmppSubmitHandler"的方法"System.IAsyncResult BeginInvoke(Sinosky.Cmpp.Message.CmppSubmit, S... 阅读全文

posted @ 2005-11-28 19:14 mahope 阅读(1854) 评论(0) 推荐(0)

NHibernate 执行内嵌类(Nested Class)查询
摘要:为了使用NHibernate执行内嵌类查询,我修改了NHibernate的源代码,增加了两个语句。 /*SessionFactoryImpl.cs*//// /// /// /// /// public string[ ] GetImplementors( System.Type clazz ) { ... 阅读全文

posted @ 2005-05-21 15:36 mahope 阅读(622) 评论(0) 推荐(0)

为内嵌类(Nested Class)配置NHibernate的O/R Mapping文件
摘要:对于内嵌类的hibernate-mapping,如果用MyParentClass.MyNestedClass指定类名将会引发如下的异常: NHibernate.MappingException : associated class not found ----> System.TypeLoadException : 未能从程序集 MyAssembly 中加载类型 MyParentClass.M... 阅读全文

posted @ 2005-05-19 00:11 mahope 阅读(746) 评论(0) 推荐(0)

NUnit ERROR DOMConfigurator: ConfigureFromXML called with null 'element' parameter
摘要:原因:没有为dll指定正确的配置文件解决办法:1. 如果是用Visual Studio .NET,在预生成事件命令行中键入: copy /y "$(ProjectDir)App.config" "$(TargetPath).config"copy /y "$(ProjectDir)hibernate.cfg.xml" "hibernate.cfg.xml"2.在NUnit gui 中的proje... 阅读全文

posted @ 2005-05-18 02:58 mahope 阅读(793) 评论(0) 推荐(0)

用 Interpreter 模式设计算24的程序
摘要:这两天学习设计模式,弄了一个算24的程序。 程序是这样的:任意给出4个1-10的数,加上+ - * / 四个运算符中选择三个进行排列组合。 按照逆波兰表达式 用 Interpreter 模式解析这个字符串序列,并且计算结果,如果等于24就打印出表达式。 其中排列组合采用了微软网站上的代码,其他部分都是原创。 这里提供c#项目源代码供大家参考 上下文类: public... 阅读全文

posted @ 2005-05-04 11:20 mahope 阅读(1834) 评论(4) 推荐(0)

如果需要对DataTable进行大批量Select查询,首先为表创建DataView
摘要:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconviewingdataindatatable.asp TipIf you will be performing a number of calls to the Select method of a DataTable, yo... 阅读全文

posted @ 2005-01-18 11:29 mahope 阅读(1055) 评论(0) 推荐(0)

FIX: Socket Initialization Does Not Succeed if Your Computer Has More Than 50 Network Bound Protocols
摘要:SYMPTOMS If you use the Microsoft .NET Framework 1.1, and if your computer has more than 50 network bound protocols, you may receive the following error message: System.Net.Sockets.Socke... 阅读全文

posted @ 2004-12-10 13:04 mahope 阅读(835) 评论(0) 推荐(0)

对于此 appdomain 已禁用了程序集的 HTTP 下载
摘要:从ASP.NET中使用Assembly.LoadFrom("http://...")时,会发生此异常。 可能安全性设置不允许从站点以外的位置下载程序集,但是尚未找到在什么地方可以修改此设置。 阅读全文

posted @ 2004-12-08 15:07 mahope 阅读(677) 评论(0) 推荐(0)

Expression Evaluator
摘要:In my last c# project, I need provide a special function, which isshowing some menu items whose caption are not constant values. For example, an menu item's caption may be "Today(nov. 30)'s new blog... 阅读全文

posted @ 2004-11-30 14:55 mahope 阅读(2428) 评论(3) 推荐(0)

MarshalByRefObject vs Serializable in Remoting scenario
摘要:What's defference between MarshalByRefObject and Serializable in Remoting scenario.Performance consideration... 阅读全文

posted @ 2004-11-24 21:10 mahope 阅读(972) 评论(1) 推荐(0)

Usefull Attribute of c#
摘要:Usefull Attribute of c#Recently, I have finished a project of sms.The protocol of pdu is cmpp. There are a lot of handy source codes available for me. But I decided to build it from scratch.In th... 阅读全文

posted @ 2004-11-23 01:06 mahope 阅读(796) 评论(0) 推荐(0)