Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Billing.Test/Program.cs @ 13783

Last change on this file since 13783 was 10013, checked in by spimming, 11 years ago

#1888:

  • enabled transactions
  • enabled tracing output
  • set correct invoice data
  • saving invoices
File size: 1.6 KB
RevLine 
[9576]1using System;
[9602]2using System.Data.Entity.Infrastructure;
[9619]3using System.Diagnostics;
[9602]4using System.IO;
[9619]5using System.Threading;
[9576]6using HeuristicLab.Services.Optimization.Billing.DataAccess;
[9579]7using HeuristicLab.Services.Optimization.Billing.Model;
[9576]8
9namespace HeuristicLab.Services.Optimization.Billing.Test {
10  class Program {
[10013]11    private static HeuristicLab.Services.Optimization.Billing.BillingEngine.BillingEngine billingEngine;
[9619]12    private static Thread billingEngineThread;
13
[9576]14    static void Main(string[] args) {
[9602]15      string ddlScript;
[9579]16      using (var context = new BillingContext()) {
[9602]17        ddlScript = (((IObjectContextAdapter)context).ObjectContext.CreateDatabaseScript());
[9579]18      }
19
[9602]20      using (StreamWriter writer = new StreamWriter(@"..\..\DDLScript.sql")) {
21        writer.Write(ddlScript);
22      }
23
[9576]24      //BillingService srv = new BillingService();
25      BillingDao dao = new BillingDao();
[9579]26      var products = dao.FindAllProducts();
27      foreach (Product p in products) {
28        Console.WriteLine(string.Format("{0}: {1}", p.ProductId, p.Name));
29      }
[9576]30
[9619]31      // Start BillingEngine Service:
32      Trace.WriteLine("Starting BillingEngine ...");
33      try {
34        billingEngine = new BillingEngine.BillingEngine();
35        billingEngineThread = new Thread(billingEngine.Run);
36        billingEngineThread.IsBackground = true; //dont keep app alive
37        billingEngineThread.Start();
38      }
39      catch (Exception e) {
40        Trace.WriteLine("Error during BillingEngine startup: " + e.Message);
41      }
42
[9576]43      Console.WriteLine("Press any key to exit...");
44      Console.ReadKey();
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.