LiteApplication subclass Setup()

Bread
edited October 2011 in Photon Server
Hey,

I'm extending the Lite Application (Like the MyApplication example). I have a database where i load data from when needed, but when something of the data changes, i don't want to directly update it to the database, instead i want to update it in bulks after each x seconds. Or in general, where do i place global data, that is not specific to one single room or player ?

So i tried to create a timer in a subclass from LiteApplication and override the Setup Method, to start the timer. But the server is not calling Setup(), only the one in LiteApplication.
public class MyApplication : LiteApplication
{
     // [...]

     protected override void Setup()
     {
        // do something
     }
}

Am i missing something, or is it even a false approach for such task ?

Greetings

Comments

  • did you configure MyApplication in the photonserver.config file instead of LiteApplication ?
  • You mean this?:

    PhotonServer.config:

    I outcommented all the other applications.
    [...]
    <Applications Default="MyApplication">
    			<Application
    				Name="MyApplication"
    				BaseDirectory="MyApplication"
    				Assembly="MyApplication"
    				Type="MyApplication.MyApplication"
    				EnableAutoRestart="true"
    				WatchFiles="dll;config"
    				ExcludeFiles="log4net.config">
    			</Application>
    

    The server logs also say that it gets started.
    One thing to mention: It uses the right CreatePeer method ( the one in MyApplication, tested it with a log message ), but not the Setup method.
  • that would be odd since LiteApplication.Setup is definitely called for Lite, and if you are overriding it your Setup method should be called as well.
  • Hey,

    Okay, my fault, works now ;)
         protected override void Setup()
            {
                Log.Error("setup"); // does not work since the logger is initalizied in base.Setup()
    
                base.Setup();
    
                Log.Error("after base.Setup()"); // works
            }
    

    Thanks anyway!