It looks that I can use
public virtual void OnServiceStartup(
object sender,
ServiceStartupEventArgs e) to implement one of them. I have made a prototype, but it is not working. I have created a assembly which contain a class below and put this assembly with other BOS assemblies the same place. Do I miss anything ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IdeaBlade.EntityModel;
using System.IO;
namespace DomainModel
{
public class ServiceApp : EntityServiceApplication
{
public void OnServiceStartUp(object sender, ServiceStartupEventArgs e)
{
string LogFile = "logFile.txt";
LogMessage("Service Starting up ...", LogFile);
base.OnServiceStartup(sender, e);
}
public void OnServceShutdown(object sender, EventArgs e)
{
string LogFile = "logFile.txt";
LogMessage("Service Shuting Down ...", LogFile);
base.OnServiceShutdown(sender, e);
}
public static void LogMessage(String strLogMe, string logfile)
{
// if (IsLogOn)
// {
FileStream fs = new FileStream(logfile, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(DateTime.UtcNow.ToString() + " : " + strLogMe);
m_streamWriter.Flush();
m_streamWriter.Close();
//}
}
}
}