You must Sign In to post a response.
  • Category: Webservices

    SingleTon object of WebServices (Please be specific as required and not be generic)

    // Singleton Object of viewservice
    private ViewService WorkListView = null;
    ViewServiceObjectCreation viewstrWorkListView = ViewServiceObjectCreation.GetObject();

    // Object Creation
    public class ViewServiceObjectCreation
    {
    private static ViewServiceObjectCreation singleTonObject=null;
    private static readonly object lockingObject = new object();
    private ViewServiceObjectCreation()
    {

    }
    public static ViewServiceObjectCreation GetObject()
    {
    if(singleTonObject == null)
    {
    lock (lockingObject)
    {
    if(singleTonObject == null)
    {
    singleTonObject = new ViewServiceObjectCreation();
    }
    }
    }
    return singleTonObject;
    }
    }

    But this is not creating specific object. How to create service singleton object
  • #756300
    Here is a sample code for singleton



    using System;

    public class Singleton
    {
    private static Singleton instance;

    private Singleton() {}

    public static Singleton Instance
    {
    get
    {
    if (instance == null)
    {
    instance = new Singleton();
    }
    return instance;
    }
    }
    }

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM


  • Sign In to post your comments