1. Home
  2. Docs
  3. Llamachant Framework Modules
  4. Extended Functionality
  5. SingletonBO Attribute

SingletonBO Attribute

Use the SingletonBO attribute to always show an object in a Detail View instead of a List View. When you create your business object, you should plan to only ever have one instance of it in your database. This attribute is replacing the now obsolete ISingletonBO interface.

				
					 [SingletonBO]
 public class ApplicationSettings : XPCustomObject
    {
        private static Guid oid = Guid.Parse("3a58c6ae-811a-4a62-a15a-24856f1bec0b");

        public ApplicationSettings(Session session)
            : base(session)
        {
        }
        
        [VisibleInDetailView(false), VisibleInListView(false), VisibleInLookupListView(false)]
        [Key]
        public Guid Oid { get => oid; set { } }

//We create this section below for convenience and is not required
        public static ApplicationSettings GetInstance(IObjectSpace space) 
        { 
            return GetInstance((space as XPObjectSpace).Session); 
        }
        
        public static ApplicationSettings GetInstance(Session session)
        {
            ApplicationSettings settings = session.GetObjectByKey<ApplicationSettings>(oid);
            if (settings == null)
                settings = new ApplicationSettings(session);

            return settings;
        }
    }

       
				
			
Was this article helpful to you? Yes 1 No

How can we help?