Skip to main content

Posts

Showing posts from November, 2007

Throwing custom Web Service Exception from Web Service

Suppose in a real scenario an exception is generated in the Data access or any other layer of our application and we want to show a custom message then we can use SoapException class in System.Web.Services.Protocols which will do the trick for us. This is sample DAO class which has a method getEmpData which throws an exception 1 public class DAO 2 { 3 public DAO() 4 { 5 // 6 // TODO: Add constructor logic here 7 // 8 } 9 10 public static string getEmpData( int id) 11 { 12 throw new Exception( "Method not supported" ); 13 14 } 15 } The following is a sample Webservice with the webmethod in the same project which used the above DAO class 1 using System; 2 using System.Web; 3 using System.Web.Services; 4 using System.Web.Services.Protocols; 5 6 [WebService(Namespace = "http: //tempuri.org/")] 7 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 8 publi

A, B , C & now F# programming language

What sort of language is F#? F# is derived from the ML family of languages , part of the functional programming language tradition. However, F# is not simply a functional language: it is a multi-paradigm langauge that attempts to capture the best of both functional and object-oriented programming in the context of .NET. Furthermore, even when used as a purely functional language F# is remarkable for the sheer power of the libraries and tools available through .NET. The distinctive features of all ML-family languages are strong static type checking, excellent type inference, lightweight and typesafe function types, safe and syntactically convenient discriminated unions. These core work together to allow for succinct yet efficient solutions to many programming problems, and repeatedly permit common patterns of coding to be abstracted very easily. What are the goals of F#? One way of looking at it i

ASP.NET MVC Framework

How often we have dreamed of a tool which would create all those patterns for us. It seems that Gods at Microsoft have listened our prayers. Microsoft is going to release a new framework with MVC support What is MVC? Model The domain-specific representation of the information that the application operates. Domain logic adds meaning to raw data (e.g., calculating whether today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items). Many applications use a persistent storage mechanism (such as a database) to store data. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the Model. View Renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes. Controller Processes and responds to events, typically user actions, and may invoke changes on the model. ASP.NET MVC Framewo