Cache me if you can

22 בנובמבר 2007

  WCF provides nice capability of extending the behavior of operations by implementing IOperationBehavior interface. I want to concentrate on ApplyDispatchBehavior method of that interface, which purpose is to do extention to server side calls. I will show how I use this extensability to provide a nice and easy cache mechanisam. I will make a class which derives from Attribute class and implements an IOperationBehavior interface. Now I want to interfire in the invoke process of the method so I need to make another class that implements IOperationInvoker interface and would hold the cache logic. And...
תגיות: ,
3 תגובות

Caching with WCF

21 בנובמבר 2007

  Asp.Net provides us very powerful cache mechanism that can be found under System.Web.Caching. You can access the cache using the folioing syntax: HttpContext.Current.Cache = value; HttpContext.Current.Cache.Add(params...); Lately I was looking for similar mechanism to use with WCF. The flax ability of WCF services provide them to live in supported as well not supported web environment. In that case HttpContext.Current would not be available. From curiosity I went and check how the HttpContext.Current.Cache property is implemented and I was surprised to see the all it does is: return HttpRuntime.Cache. After googling I was more...
תגיות: ,
24 תגובות

Testable code – is it worth it?

17 בנובמבר 2007

  Recently I been refactoring some legasy code and writing a new one. I am using Rhino mocks to run my units and for that I have to write my code in a testable way. This approach makes my code looks not exactly the way I designed and want it to be. Eli Lopian wrote an article about this issue – "Stop Designing for Testability" and has some points to think of. In my opinion, if we have to write very simple code to encapsulate some internal logic for our base class and make sure that...
תגיות:
3 תגובות

TFSBuild – not the right way to do continues integration.

21 באוקטובר 2007

  In the past few days I been dealing with setting up continues integration (CI) process in my team. The process is not finished yet but be ready for a post at the minute when it will be done. CI is dealing with automated builds so I needed some automated build tool to handle the job. No so long ago I have been working with MSBuild, which is very powerful tool to manage your build process. However lately more and more often I run in to TFSBuild (which is a tool for automated build that come with TFS) relative with...
2 תגובות

Mocking internal methods and classes with Rhino.Mocks

13 באוקטובר 2007

  After my trip to Thailand Last month (see some photos) I back and jumped right in to coding. I wrote some code at work and tried to fix some unit tests for it using Rhino Mocks. I guess you all familiar with that powerful tool and I will not try to explain how to use it, it been done perfectly by some of my colleagues. I wrote a class like this: public class User { private void DoSomeLogic() { } public void Add() { DoSomeLogic(); ...
תגיות: ,
2 תגובות

What is the most efficient why to read XML files?

18 ביולי 2007

In my last code review, which has made by shani raba, he have write me down a comment about the way that I read data from XML file, which is with the help of XmlDocument. And his point was that that way it is much slower then with, lets say, XmlReader. So I have googled and came up with those conclusions. Using a XmlDocument for reading XML files is really a bit slower then using XmlRaeder. Although if you need also to write into the XML this would be the prepared option. The XmlReader work 2-3 times faster then...
3 תגובות

Introduction to WCF

3 ביוני 2007

WCF (Windows Communication Foundation) is part of WinFx technology. Its taking care of the communication between your components in you own machine and your components and the the out side world. I was learning about this for the last two months and already took advantage of it and use it in a new project in my work. Last week I made some introduction presentation for my team about it.The attachment includes it and some example of how to build and expose a simple wcf service More advanced examples coming soon.
תגיות:
2 תגובות

Manage your web projects deployment

18 במאי 2007

We all know how to extent and run MSBuild with our library console and forms applications, but what about the web applications?Dose anyone ask himself once – where did the .proj file of my web project gone?To solve this mystery Microsoft has come with Web Deployment Projects.Now by simply clicking on our web project and editing a Web Deployment Projectyou get a .wdproj, which is exactly functioning like the .proj file. And you can you it advances oprions to manage your section in the config file depending on the compilation mode (release, debug or add one of your...
אין תגובות

MSBuild Logger Verbosity

When you build your .net 2.0 projects there are notes appear in the Output window. Those notes are generated by the MSBuild engine. By default the verbosity detailing level of those notes is very common and don't include all the output that given by MSBuild.You can change the verbosity detailing level by changing the following key in the registry HKEY_USERS\S-1-5-21-57989841-1409082233-839522115-1003\Software\Microsoft\VisualStudio\8.0\General key value named MSBuildLoggerVerbosity.There are four levels, the default is 2. If you want to see the messages then you have to set the value at least to 3. I don’t recommend setting the 4 level because...
2 תגובות

Extending the build process – GacUtil task

As part of planning a daily build process I needed to register the current assembly to the GAC. I was Surprised to find that there is no such a task that came with the VS tasks kit. And I was event more surprised to not find such a task in the common extension tasks kit for MSBuild. So I said "This all mechanism is so easily extendable so why no write a task for my own to cover this issue? – and practice in writing MSBuild tasks in the way". So that's what I did.I write some custom...
26 תגובות