TFS – My View (1)


It is funny when I use TFS from Microsoft. Not I want to judge them badly, I am just saying my opinion. Well I am using that because it is one of the requirement from a very influenced client. They have implement TFS and stuffs, so I follow.

Okay, what I feel is not so good is that TFS freeze my Visual Studio every time I want to perform check-in. Well, my connection may be slow, but it is the main problem. The server out there may have been waiting for long, my machine is waiting. They both keep waiting, and stupid time. I can’t continue on my work. What should I do? Edit those codes that using Framework using notepad++? What about no?!

I think it is very important for such tasks to be done in the background. So that small developer like me wont have to wait for long to continue working.

And also I add an index (1) there at the title because I want this impression to continue. It is not always bad what this TFS had.

Sitecore – Web Service


I don’t know whether I should hold my post for another day or I keep posting everything. But well, I am in mood to post things, so here it is.

Somehow, I develop a web that using javascript to run a serverside method. Yes, sometimes you need that. I figure it out how to use that and I got the answer: web service.

Sitecore has provide its developer with a web service to access some functions. You can find it on /sitecore/shell/Webservice/Service.asmx Well they provide some useful functions I told you and you might need that. But those functions are not always needed (I guess). For me, (I don’t know about others) I use web service to access data that my application provide not the data that CMS provide for my application. For example, sitecore is providing me the list of users, I really don’t need to use web service (at least until now) to access that. My application provide a list of products and I need to access them from anywhere. Oh, and by the way, if you use the web service that Sitecore provide you will be logged in as sitecore/* user.

So, I create a custom web service in my application. Just say that the web service provide me a function that returns a list of string. I have to call it using javascript. How do I do that? Here’s the step.

  1. Add [System.Web.Script.Services.ScriptService] tag before your web service class definition. So it will become like the code below.

    [System.Web.Script.Services.ScriptService]
    public class ClassName : System.Web.Services.WebService
    
  2. You need to register your service in your web control. Using the code below, you can register the web service as a script on a control.

    <asp:ScriptManager ID="_scriptManager" runat="server">
      <Services>
        <asp:ServiceReference Path="/path/to/your/web/service.asmx" />
      </Services>
    </asp:ScriptManager>
    
  3. Then you may call it using javascript using the code below.

    The.Namespace.Of.Your.Web.Service.WSName.MethodName([params,]OnSuccess,OnFail,userContext);
    

    Params is all parameters needed by your web service method. OnSuccess is a function that will process the result if there is no error. OnFail is a function that will process the result if there is any error. And I haven’t used userContext. 😀

  4. the function to process the result will be like

    function FunctionName(result) {
        /* body */
    }
    

Simple right? Just four steps to use it. You can do most of anything. And if you want to use the web service from the server side C# code, it becomes even simpler. You only need to add reference then use it as you like.