0
我有一個很大的工作,代碼:C#quartz.net一個大作業SQL連接
public class TbcMailSender : IJob
{
public void Execute(IJobExecutionContext context)
{
using(EFDbContext _db = new EFDbContext()){
_db.JobTests.Add(new JobTest
{
Name = "trigger",
JobDate = DateTime.Now
});
_db.SaveChanges();
var parserHelper = ParserHelper.GetParserHelper(_db);
try
{
parserHelper.Bfm();
}
catch (Exception)
{
}
try
{
parserHelper.Bpn();
}
catch (Exception)
{
}
try
{
parserHelper.Commersant();
}
catch (Exception)
{
}
try
{
parserHelper.Ghn();
}
catch (Exception)
{
}
try
{
parserHelper.Ipn();
}
catch (Exception)
{
}
try
{
parserHelper.PirveliRadio();
}
catch (Exception)
{
}
try
{
parserHelper.Forbes();
}
catch (Exception)
{
}
try
{
parserHelper.Marketer();
}
catch (Exception)
{
}
}
}
}
每個方法大概需要2-3分鐘(BFM,BPN ...營銷)。在將來我會添加更多的方法,是否有可能會發生SQL連接超時異常?對於exta安全性,我應該增加連接超時嗎?每種方法都需要與數據庫進行交互