Silverlight introduction

Software Development May 12th, 2007

At Mix07, Microsoft announced Silverlight™.

Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web.

You can read more here (SilverLight site), its amazing!

Great post about Silverlight UI Controls, by Ashish Shetty, you can find here.

Slides and demos you can download from Nikhil Kothari's Weblog.

Enjoy!

Tags: ,

How to: Calling Web Services methods from Client Script in ASP.NET AJAX

Software Development May 12th, 2007

My previos post explained the way to expose a web service to client script in Ajax. This post will introduce the "How to" call the web service's method from the client script.

Our web service is:

 123456789101112131415161718 
  namespace MySamples.BL{    [WebService(Namespace   = " http://tempuri.org/")]    [ScriptService]     public   class MyWebService : System.Web.Services.WebService    {        [WebMethod]          public string PrintString(String input)        {              return input;        }        [WebMethod]        public   string SayHello()        {            return   "Hello";        }    }}

Calling a Web service method from script is asynchronous. Succeeded callback function must provided to get a return value or to determine when the request has returned. This function is invoked when the request has finished successfully with return value (as a parameter) from the Web method call. Failed callback function can also provided to handle errors.

Based on the previous post, this is what you should do in the client script.

The script is:

 123456789101112131415161718192021222324 
  // This function calls the Web service method   // without parameters and // passes the event callback function.    function SayHello(){    MySamples.BL.MyWebService.SayHello(SucceededCallback);}

// This function calls the Web service method
// passing simple type parameters and the
// callback function 
function PrintString(str)
{
    MySamples.BL.MyWebService.PrintString(str,SucceededCallback);
}

// This is the callback function invoked if the Web service succeeded.
function SucceededCallback(result, eventArgs)
{
    var wsResult= document.getElementById( "wsResult");
    wsResult.innerHTML = result;
}

Thats all!

Tags: ,

How to: Expose Web Services to Client Script in AJAX

Software Development May 11th, 2007

AJAX enables you to call ASP.NET Web services by using client script. There are several steps to enable the web service exposing.

1. Qualify the Web service class with the ScriptServiceAttribute attribute:

123456789 
[ScriptService]public class MyWebService : System.Web.Services.WebService{    [WebMethod]    public string PrintString(String input)    {         return input;    }}

2. Configure the Web application to support calling Web services from script. Register the ScriptHandlerFactory HTTP handler in the Web.config file for the application:

<system.web>
   <httpHandlers>
      <remove verb=”*” path=”*.asmx”/>
      <add verb=”*” path=”*.asmx” type=”System.Web.Script.Services.ScriptHandlerFactory” validate=”false”/>
   </httpHandlers>
<system.web>

Note: The handler delegates the call to the default handler for Web service calls that are not issued from AJAX script.

3. Enable the Web service to be called from script in an ASP.NET Web page:

<asp:ScriptManager runat=”server” ID=”scriptManager”>
   <Services>
      <asp:ServiceReference path=”~/BL/MyWebService.asmx” />
   </Services>
</asp:ScriptManager>

Note: The ServiceReference object can reference a Web service only in the same domain.

JavaScript proxy class for the .asmx Web Service created by the page that contains the ScriptManager control. It occures when this page is rendered. The proxy class has methods that correspond to each Web method in the MyWebService.asmx service.

The next post will be about the way to call the Web Service.

 

del.icio.us tags: , ,

Tags: , ,

Team Project: What? Why? How?

Team System May 7th, 2007

Over the last year I frequently asked by our customers “What is the best way to structure my team projects?”.
This is a good question!
And the answer?….

Miscrosot produced a whitepaper (Guidance for Structuring Team Projects) that summarizes the factors to consider when making this choice.

Tags:

Public CTP for VSDBPro Service Release 1 is now available

Team System May 6th, 2007

The public CTP for the first service release of Visual Studio Team Edition for Database Professionals just released.
For all the details, please check out Gert’s post right here.

Tags: ,

Interface vs Abstract Class

Software Development May 6th, 2007

I frequently asked what is the difference between Interface and Abstract classes. The main difficulty is the choice of whether to design your functionality as an interface or an abstract class.

Interface
An interface is a reference type containing only abstract members. These can be events, indexers, methods or properties, but only the member declarations. A class implementing an interface must provide the implementation of the interface members. An interface cannot contain constants, constructors, data fields, destructors, static members or other interfaces. Interface member declarations are implicitly public.
An interface declaration may declare zero or more members.
All interface members implicitly have public access. It is a compile-time error for interface member declarations to include any modifiers. In particular, it is a compile-time error for an interface member to include any of the following modifiers: abstract, public, protected, internal, private, virtual, override, or static.

Abstract class
Like an interface, you cannot implement an instance of an abstract class, however you can implement methods, fields, and properties in the abstract class that can be used by the child class.
The abstract modifier is used to indicate that a class is incomplete and that it is intended to be used only as a base class. An abstract class differs from a non-abstract class is the following ways:
An abstract class cannot be instantiated directly, and it is a compile-time error to use the new operator on an abstract class. While it is possible to have variables and values whose compile-time types are abstract, such variables and values will necessarily either be null or contain references to instances of non-abstract classes derived from the abstract types.
An abstract class is permitted (but not required) to contain abstract members.
An abstract class cannot be sealed.
When a non-abstract class is derived from an abstract class, the non-abstract class must include actual implementations of all inherited abstract members
The purpose of an abstract class is to provide a base class definition for how a set of derived classes will work and then allow the programmers to fill the implementation in the derived classes.

List of similarities and differences between an interface and an abstract class:

  • In practice,an interface is a good way to encapsulate a common idea for use by a number of possibly unrelated classes, while an abstract class is a good way to encapsulate a common idea for use by a number of related classes.
  • When you need to provide common, implemented functionality among all implementations of your component, use an abstract class. Abstract classes allow you to partially implement your class, whereas interfaces contain no implementation for any members.
  • An Interface can only inherit from another Interface, when an abstract class can inherit from a class and one or more interfaces
  • An Interface cannot contain constructors or destructors, when abstract class can contain constructors or destructors.
  • An Interface can be inherited from by structures,when abstract class cannot be inherited from by structures.
  • An Interface can support multiple inheritance,when abstract class cannot support multiple inheritance.
  • Interfaces are used to define the peripheral abilities of a class;An abstract class defines the core identity of a class and there it is used for objects of the same type.
  • If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method; If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.

Tags: ,

Israeli ALM User Group – Third meeting

Community May 5th, 2007

The third meeting will take place on the 12 of May in Microsoft offices in Raanana.
Meeting subject: Team Buiid capabilites including extnesive customization issues.

You can read Sarit’s post to get more details.

Microsoft announced Silverlight

Software Development May 4th, 2007

At Mix07, Microsoft announced Silverlight™.

Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web.

You can read more here (SilverLight site), its amazing!

Great post about Silverlight UI Controls, by Ashish Shetty, you can find here.

Tags: , , ,