Print Page | Close Window

Having code execute on BOS startup?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=360
Printed Date: 19-May-2025 at 5:05pm


Topic: Having code execute on BOS startup?
Posted By: Customer
Subject: Having code execute on BOS startup?
Date Posted: 08-Aug-2007 at 12:25pm

Were working on having a memory profiler taking snapshots of the BOS while our app is running to track down a possible memory leak on the server.  Our memory profiler (.NET Memory Profiler) has an API that would let us log snapshots, but we need to start the logging as the BOS is starting up.  Is there an API that would allow us to implement an interface in one of our classes or set some kind of configuration so that the BOS would call a method in one of our classes at startup?




Replies:
Posted By: IdeaBlade
Date Posted: 08-Aug-2007 at 12:28pm

You should be able to implement a custom PersistenceServiceApplication class and override the OnServiceStartup method to do this.  This code is called when the PersistenceService instance is constructed.  Note you must include the assembly name containing your class in the <probeAssemblyName> list in the IdeaBlade.ibconfig for your implementation to be found.

 

Here’s a sample class, but there’s more information in the Consolidated Help:

 

  public class CustomPersistenceServiceApplication : PersistenceServiceApplication {

 

    public override void OnServiceStartup(object sender, ServiceStartupEventArgs e) {

      base.OnServiceStartup(sender, e);

      // Custom initialization logic

    }

  }

 

 




Print Page | Close Window