Changeset 9434 for branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3/HiveOperationContext.cs
- Timestamp:
- 05/03/13 13:47:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HivePerformance/sources/HeuristicLab.Services.Hive/3.3/HiveOperationContext.cs
r9393 r9434 22 22 using System; 23 23 using System.Collections.ObjectModel; 24 using System.Diagnostics;25 using System.IO;26 24 using System.ServiceModel; 27 25 using System.ServiceModel.Channels; 28 26 using System.ServiceModel.Description; 29 27 using System.ServiceModel.Dispatcher; 30 using System.Text;31 28 using HeuristicLab.Services.Hive.DataAccess; 32 29 33 30 namespace HeuristicLab.Services.Hive { 34 31 public class HiveOperationContext : IExtension<OperationContext> { 32 35 33 public static HiveOperationContext Current { 36 34 get { … … 42 40 public HiveDataContext DataContext { 43 41 get { 44 if (dataContext == null) { 45 dataContext = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString); 46 //dataContext.Log = new DebugWriter(); 47 } 48 return dataContext; 42 return dataContext ?? (dataContext = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)); 49 43 } 50 44 } … … 67 61 } 68 62 69 public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState) {63 public void BeforeSendReply(ref Message reply, object correlationState) { 70 64 OperationContext.Current.Extensions.Remove(HiveOperationContext.Current); 71 65 } … … 88 82 } 89 83 } 90 91 internal class DebugWriter : TextWriter {92 public override Encoding Encoding {93 get { return Encoding.UTF8; }94 }95 96 public override void Write(char value) {97 Debug.Write(value);98 }99 100 public override void Write(string value) {101 Debug.Write(value);102 }103 104 public override void WriteLine(string value) {105 Debug.WriteLine(value);106 }107 }108 84 }
Note: See TracChangeset
for help on using the changeset viewer.