I read that a web service does not have a global.asax to configure global settings (like the automapper configuration). So my question is:
Should I put the automapper configuration in every webmethod or is there a place I can put it globally?
I'm going to call the webservice of couple of thousand times every night so I'm worried that if the automapper configuration is expensive开发者_Go百科 it will take much longer. Am I correct or just worrying needlessly?
Thx, John
AutoMapper configuration is expensive, yes. I do lots of configure-time optimization to make the runtime execution fast. If you're using ASMX web services, you can still use the global.asax, as ASMX is still just hosted in ASP.NET.
If it's WCF, then it will depend on how you host WCF. Check out this post for your options:
http://blogs.msdn.com/wenlong/archive/2006/01/11/511514.aspx
精彩评论