using System; using System.Data.Entity.Infrastructure; using System.Diagnostics; using System.IO; using System.Threading; using HeuristicLab.Services.Optimization.Billing.DataAccess; using HeuristicLab.Services.Optimization.Billing.Model; namespace HeuristicLab.Services.Optimization.Billing.Test { class Program { private static BillingEngine.BillingEngine billingEngine; private static Thread billingEngineThread; static void Main(string[] args) { string ddlScript; using (var context = new BillingContext()) { System.Data.Entity.Database.SetInitializer(new HeuristicLab.Services.Optimization.Billing.DataAccess.BillingContext.BillingContextInitiliazer()); ddlScript = (((IObjectContextAdapter)context).ObjectContext.CreateDatabaseScript()); } using (StreamWriter writer = new StreamWriter(@"..\..\DDLScript.sql")) { writer.Write(ddlScript); } //BillingService srv = new BillingService(); BillingDao dao = new BillingDao(); var products = dao.FindAllProducts(); foreach (Product p in products) { Console.WriteLine(string.Format("{0}: {1}", p.ProductId, p.Name)); } // Start BillingEngine Service: Trace.WriteLine("Starting BillingEngine ..."); try { billingEngine = new BillingEngine.BillingEngine(); billingEngineThread = new Thread(billingEngine.Run); billingEngineThread.IsBackground = true; //dont keep app alive billingEngineThread.Start(); } catch (Exception e) { Trace.WriteLine("Error during BillingEngine startup: " + e.Message); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }