Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 9844 was 9619, checked in by spimming, 12 years ago

#1888:

  • Added new BillingService methods
  • Disabled proxy generation and lazy loading!
  • Extended see method with additional test data
  • Added properties to order and invoice model
  • initial commit of BillingEngine module
File size: 1.7 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 {
[9619]11    private static BillingEngine.BillingEngine billingEngine;
12    private static Thread billingEngineThread;
13
[9576]14    static void Main(string[] args) {
[9602]15      string ddlScript;
[9579]16      using (var context = new BillingContext()) {
17        System.Data.Entity.Database.SetInitializer(new HeuristicLab.Services.Optimization.Billing.DataAccess.BillingContext.BillingContextInitiliazer());
[9602]18        ddlScript = (((IObjectContextAdapter)context).ObjectContext.CreateDatabaseScript());
[9579]19      }
20
[9602]21      using (StreamWriter writer = new StreamWriter(@"..\..\DDLScript.sql")) {
22        writer.Write(ddlScript);
23      }
24
[9576]25      //BillingService srv = new BillingService();
26      BillingDao dao = new BillingDao();
[9579]27      var products = dao.FindAllProducts();
28      foreach (Product p in products) {
29        Console.WriteLine(string.Format("{0}: {1}", p.ProductId, p.Name));
30      }
[9576]31
[9619]32      // Start BillingEngine Service:
33      Trace.WriteLine("Starting BillingEngine ...");
34      try {
35        billingEngine = new BillingEngine.BillingEngine();
36        billingEngineThread = new Thread(billingEngine.Run);
37        billingEngineThread.IsBackground = true; //dont keep app alive
38        billingEngineThread.Start();
39      }
40      catch (Exception e) {
41        Trace.WriteLine("Error during BillingEngine startup: " + e.Message);
42      }
43
[9576]44      Console.WriteLine("Press any key to exit...");
45      Console.ReadKey();
46    }
47  }
48}
Note: See TracBrowser for help on using the repository browser.