- Timestamp:
- 06/20/11 14:16:53 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
r6426 r6452 113 113 #endregion 114 114 115 #region Appointment116 public static DT. Appointment ToDto(UptimeCalendarsource) {117 if (source == null) return null; 118 return new DT. Appointment { Id = source.UptimeCalendarId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate };119 } 120 public static UptimeCalendar ToEntity(DT.Appointmentsource) {121 if (source == null) return null; 122 var entity = new UptimeCalendar(); ToEntity(source, entity);123 return entity; 124 } 125 public static void ToEntity(DT. Appointment source, UptimeCalendartarget) {126 if ((source != null) && (target != null)) { 127 target. UptimeCalendarId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate;115 #region Downtimes 116 public static DT.Downtime ToDto(Downtime source) { 117 if (source == null) return null; 118 return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate }; 119 } 120 public static Downtime ToEntity(DT.Downtime source) { 121 if (source == null) return null; 122 var entity = new Downtime(); ToEntity(source, entity); 123 return entity; 124 } 125 public static void ToEntity(DT.Downtime source, Downtime target) { 126 if ((source != null) && (target != null)) { 127 target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; 128 128 } 129 129 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj
r6431 r6452 109 109 <Compile Include="Properties\AssemblyInfo.cs" /> 110 110 <None Include="Properties\AssemblyInfo.cs.frame" /> 111 <Compile Include=" Properties\Settings.Designer.cs">111 <Compile Include="Settings.Designer.cs"> 112 112 <AutoGen>True</AutoGen> 113 113 <DesignTimeSharedInput>True</DesignTimeSharedInput> … … 130 130 <SubType>Designer</SubType> 131 131 </None> 132 <None Include=" Properties\Settings.settings">132 <None Include="Settings.settings"> 133 133 <Generator>SettingsSingleFileGenerator</Generator> 134 134 <LastGenOutput>Settings.Designer.cs</LastGenOutput> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r6431 r6452 24 24 using System.Linq; 25 25 using System.Linq.Expressions; 26 using HeuristicLab.Services.Hive.Common;27 26 using HeuristicLab.Services.Hive.Common.DataTransfer; 28 using HeuristicLab.Services.Hive.DataAccess.Properties;29 27 using DT = HeuristicLab.Services.Hive.Common.DataTransfer; 30 28 … … 33 31 public static HiveDataContext CreateContext(bool longRunning = false) { 34 32 var context = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString); 35 if (longRunning) context.CommandTimeout = (int) ApplicationConstants.LongRunningDatabaseCommandTimeout.TotalSeconds;33 if (longRunning) context.CommandTimeout = (int)Settings.Default.LongRunningDatabaseCommandTimeout.TotalSeconds; 36 34 return context; 37 35 } … … 109 107 where child.ParentJobId == ar.Job.JobId 110 108 select child).Count() > 0 111 orderby ar.Job.Priority , db.Random() descending109 orderby ar.Job.Priority descending, db.Random() 112 110 select Convert.ToDto(ar.Job); 113 111 return count == 0 ? query.ToArray() : query.Take(count).ToArray(); … … 127 125 && ar.Job.CoresNeeded <= slave.FreeCores 128 126 && ar.Job.MemoryNeeded <= slave.FreeMemory 129 orderby ar.Job.Priority , db.Random() descending// take random job to avoid the race condition that occurs when this method is called concurrently (the same job would be returned)127 orderby ar.Job.Priority descending, db.Random() // take random job to avoid the race condition that occurs when this method is called concurrently (the same job would be returned) 130 128 select Convert.ToDto(ar.Job); 131 129 var waitingJobs = (count == 0 ? query : query.Take(count)).ToArray(); … … 634 632 #endregion 635 633 636 #region AppointmentMethods637 public Appointment GetAppointment(Guid id) {638 using (var db = CreateContext()) { 639 return Convert.ToDto(db. UptimeCalendars.SingleOrDefault(x => x.UptimeCalendarId == id));640 } 641 } 642 643 public IEnumerable< Appointment> GetAppointments(Expression<Func<UptimeCalendar, bool>> predicate) {644 using (var db = CreateContext()) { 645 return db. UptimeCalendars.Where(predicate).Select(x => Convert.ToDto(x)).ToArray();646 } 647 } 648 649 public Guid Add Appointment(Appointmentdto) {650 using (var db = CreateContext()) { 651 var entity = Convert.ToEntity(dto); 652 db. UptimeCalendars.InsertOnSubmit(entity);653 db.SubmitChanges(); 654 return entity. UptimeCalendarId;655 } 656 } 657 658 public void Update Appointment(Appointmentdto) {659 using (var db = CreateContext()) { 660 var entity = db. UptimeCalendars.FirstOrDefault(x => x.UptimeCalendarId == dto.Id);661 if (entity == null) db. UptimeCalendars.InsertOnSubmit(Convert.ToEntity(dto));662 else Convert.ToEntity(dto, entity); 663 db.SubmitChanges(); 664 } 665 } 666 667 public void Delete Appointment(Guid id) {668 using (var db = CreateContext()) { 669 var entity = db. UptimeCalendars.FirstOrDefault(x => x.UptimeCalendarId == id);670 if (entity != null) db. UptimeCalendars.DeleteOnSubmit(entity);634 #region Downtime Methods 635 public DT.Downtime GetDowntime(Guid id) { 636 using (var db = CreateContext()) { 637 return Convert.ToDto(db.Downtimes.SingleOrDefault(x => x.DowntimeId == id)); 638 } 639 } 640 641 public IEnumerable<DT.Downtime> GetDowntimes(Expression<Func<Downtime, bool>> predicate) { 642 using (var db = CreateContext()) { 643 return db.Downtimes.Where(predicate).Select(x => Convert.ToDto(x)).ToArray(); 644 } 645 } 646 647 public Guid AddDowntime(DT.Downtime dto) { 648 using (var db = CreateContext()) { 649 var entity = Convert.ToEntity(dto); 650 db.Downtimes.InsertOnSubmit(entity); 651 db.SubmitChanges(); 652 return entity.DowntimeId; 653 } 654 } 655 656 public void UpdateDowntime(DT.Downtime dto) { 657 using (var db = CreateContext()) { 658 var entity = db.Downtimes.FirstOrDefault(x => x.DowntimeId == dto.Id); 659 if (entity == null) db.Downtimes.InsertOnSubmit(Convert.ToEntity(dto)); 660 else Convert.ToEntity(dto, entity); 661 db.SubmitChanges(); 662 } 663 } 664 665 public void DeleteDowntime(Guid id) { 666 using (var db = CreateContext()) { 667 var entity = db.Downtimes.FirstOrDefault(x => x.DowntimeId == id); 668 if (entity != null) db.Downtimes.DeleteOnSubmit(entity); 671 669 db.SubmitChanges(); 672 670 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
r6431 r6452 1 1 <?xml version="1.0" encoding="utf-8"?><Database Name="HeuristicLab.Hive" Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007"> 2 <Connection Mode="AppSettings" ConnectionString="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.4;Integrated Security=True" SettingsObjectName="HeuristicLab.Services.Hive.DataAccess.Properties.Settings" SettingsPropertyName="HeuristicLab_Hive_LinqConnectionString" Provider="System.Data.SqlClient" /> 2 3 <Table Name="dbo.AssignedResources" Member="AssignedResources"> 3 4 <Type Name="AssignedResource"> … … 38 39 <Association Name="Resource_AssignedResource" Member="AssignedResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedResource" /> 39 40 <Association Name="Resource_Resource" Member="ChildResources" ThisKey="ResourceId" OtherKey="ParentResourceId" Type="Resource" /> 40 <Association Name="Resource_ UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />41 <Association Name="Resource_Downtime" Member="Downtimes" Storage="_UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="Downtime" /> 41 42 <Association Name="Resource_StateLog" Member="StateLogs" ThisKey="ResourceId" OtherKey="SlaveId" Type="StateLog" /> 42 43 <Association Name="Resource_Resource" Member="ParentResource" ThisKey="ParentResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" /> … … 82 83 </Type> 83 84 </Table> 84 <Table Name="dbo. UptimeCalendar" Member="UptimeCalendars">85 <Type Name=" UptimeCalendar">86 <Column Name=" UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />85 <Table Name="dbo.Downtime" Member="Downtimes"> 86 <Type Name="Downtime"> 87 <Column Name="DowntimeId" Storage="_UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 87 88 <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 88 89 <Column Name="StartDate" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> … … 91 92 <Column Name="Recurring" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 92 93 <Column Name="RecurringId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 93 <Association Name="Resource_ UptimeCalendar" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" />94 <Association Name="Resource_Downtime" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" /> 94 95 </Type> 95 96 </Table> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
r6431 r6452 34 34 </classShape> 35 35 <classShape Id="8d5712f7-7a1a-4a89-bd4d-fd60200d3306" absoluteBounds="13.5, 2.5, 2, 2.1554996744791666"> 36 <DataClassMoniker Name="/HiveDataContext/ UptimeCalendar" />36 <DataClassMoniker Name="/HiveDataContext/Downtime" /> 37 37 <nestedChildShapes> 38 38 <elementListCompartment Id="7d8f121b-35bb-4753-a25f-3fac1562e68e" absoluteBounds="13.515, 2.9600000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> … … 69 69 </nodes> 70 70 </inheritanceConnector> 71 <associationConnector edgePoints="[(1 1.9843735 : 2.57859537760417); (11.9843735 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">71 <associationConnector edgePoints="[(12.25 : 2.57859537760417); (12.25 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 72 72 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" /> 73 73 <nodes> … … 97 97 </nodes> 98 98 </associationConnector> 99 <associationConnector edgePoints="[(12.781252 : 2.57859537760417); (12.781252 : 3.54212367513021); (13.5 : 3.54212367513021)]" fixedFrom="NotFixed" fixedTo="NotFixed">100 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_UptimeCalendar" />101 <nodes>102 <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />103 <classShapeMoniker Id="8d5712f7-7a1a-4a89-bd4d-fd60200d3306" />104 </nodes>105 </associationConnector>106 99 <classShape Id="6bc13f26-f9a8-4597-b054-35be34190d12" absoluteBounds="4.125, 1, 2, 1.3862939453125"> 107 100 <DataClassMoniker Name="/HiveDataContext/JobData" /> … … 228 221 </nodes> 229 222 </associationConnector> 223 <associationConnector edgePoints="[(12.781252 : 2.57859537760417); (12.781252 : 3.64829952604167); (13.5 : 3.64829952604167)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 224 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Downtime" /> 225 <nodes> 226 <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" /> 227 <classShapeMoniker Id="8d5712f7-7a1a-4a89-bd4d-fd60200d3306" /> 228 </nodes> 229 </associationConnector> 230 230 </nestedChildShapes> 231 231 </ordesignerObjectsDiagram> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
r6431 r6452 12 12 namespace HeuristicLab.Services.Hive.DataAccess 13 13 { 14 using System.Data.Linq; 15 using System.Data.Linq.Mapping; 16 using System.Data; 17 using System.Collections.Generic; 18 using System.Reflection; 19 using System.Linq; 20 using System.Linq.Expressions; 21 using System.ComponentModel; 22 using System; 14 using System; 15 using System.ComponentModel; 16 using System.Data.Linq; 17 using System.Data.Linq.Mapping; 23 18 24 19 … … 46 41 partial void UpdateJob(Job instance); 47 42 partial void DeleteJob(Job instance); 48 partial void Insert UptimeCalendar(UptimeCalendarinstance);49 partial void Update UptimeCalendar(UptimeCalendarinstance);50 partial void Delete UptimeCalendar(UptimeCalendarinstance);43 partial void InsertDowntime(Downtime instance); 44 partial void UpdateDowntime(Downtime instance); 45 partial void DeleteDowntime(Downtime instance); 51 46 partial void InsertHiveExperiment(HiveExperiment instance); 52 47 partial void UpdateHiveExperiment(HiveExperiment instance); … … 81 76 #endregion 82 77 78 public HiveDataContext() : 79 base(global::HeuristicLab.Services.Hive.DataAccess.Settings.Default.HeuristicLab_Hive_LinqConnectionString, mappingSource) 80 { 81 OnCreated(); 82 } 83 83 84 public HiveDataContext(string connection) : 84 85 base(connection, mappingSource) … … 145 146 } 146 147 147 public System.Data.Linq.Table< UptimeCalendar> UptimeCalendars148 { 149 get 150 { 151 return this.GetTable< UptimeCalendar>();148 public System.Data.Linq.Table<Downtime> Downtimes 149 { 150 get 151 { 152 return this.GetTable<Downtime>(); 152 153 } 153 154 } … … 877 878 private EntitySet<Resource> _ChildResources; 878 879 879 private EntitySet< UptimeCalendar> _UptimeCalendars;880 private EntitySet<Downtime> _UptimeCalendars; 880 881 881 882 private EntitySet<StateLog> _StateLogs; … … 901 902 this._AssignedResources = new EntitySet<AssignedResource>(new Action<AssignedResource>(this.attach_AssignedResources), new Action<AssignedResource>(this.detach_AssignedResources)); 902 903 this._ChildResources = new EntitySet<Resource>(new Action<Resource>(this.attach_ChildResources), new Action<Resource>(this.detach_ChildResources)); 903 this._UptimeCalendars = new EntitySet< UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars));904 this._UptimeCalendars = new EntitySet<Downtime>(new Action<Downtime>(this.attach_UptimeCalendars), new Action<Downtime>(this.detach_UptimeCalendars)); 904 905 this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs)); 905 906 this._ParentResource = default(EntityRef<Resource>); … … 1017 1018 } 1018 1019 1019 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_ UptimeCalendar", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")]1020 public EntitySet< UptimeCalendar> UptimeCalendars1020 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_Downtime", Storage="_UptimeCalendars", ThisKey="ResourceId", OtherKey="ResourceId")] 1021 public EntitySet<Downtime> Downtimes 1021 1022 { 1022 1023 get … … 1121 1122 } 1122 1123 1123 private void attach_UptimeCalendars( UptimeCalendarentity)1124 private void attach_UptimeCalendars(Downtime entity) 1124 1125 { 1125 1126 this.SendPropertyChanging(); … … 1127 1128 } 1128 1129 1129 private void detach_UptimeCalendars( UptimeCalendarentity)1130 private void detach_UptimeCalendars(Downtime entity) 1130 1131 { 1131 1132 this.SendPropertyChanging(); … … 2040 2041 } 2041 2042 2042 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo. UptimeCalendar")]2043 public partial class UptimeCalendar: INotifyPropertyChanging, INotifyPropertyChanged2043 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Downtime")] 2044 public partial class Downtime : INotifyPropertyChanging, INotifyPropertyChanged 2044 2045 { 2045 2046 … … 2066 2067 partial void OnValidate(System.Data.Linq.ChangeAction action); 2067 2068 partial void OnCreated(); 2068 partial void On UptimeCalendarIdChanging(System.Guid value);2069 partial void On UptimeCalendarIdChanged();2069 partial void OnDowntimeIdChanging(System.Guid value); 2070 partial void OnDowntimeIdChanged(); 2070 2071 partial void OnResourceIdChanging(System.Guid value); 2071 2072 partial void OnResourceIdChanged(); … … 2082 2083 #endregion 2083 2084 2084 public UptimeCalendar()2085 public Downtime() 2085 2086 { 2086 2087 this._Resource = default(EntityRef<Resource>); … … 2089 2090 2090 2091 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier", IsPrimaryKey=true, IsDbGenerated=true)] 2091 public System.Guid UptimeCalendarId2092 public System.Guid DowntimeId 2092 2093 { 2093 2094 get … … 2099 2100 if ((this._UptimeCalendarId != value)) 2100 2101 { 2101 this.On UptimeCalendarIdChanging(value);2102 this.OnDowntimeIdChanging(value); 2102 2103 this.SendPropertyChanging(); 2103 2104 this._UptimeCalendarId = value; 2104 this.SendPropertyChanged(" UptimeCalendarId");2105 this.On UptimeCalendarIdChanged();2105 this.SendPropertyChanged("DowntimeId"); 2106 this.OnDowntimeIdChanged(); 2106 2107 } 2107 2108 } … … 2232 2233 } 2233 2234 2234 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_ UptimeCalendar", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]2235 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_Downtime", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")] 2235 2236 public Resource Resource 2236 2237 { … … 2249 2250 { 2250 2251 this._Resource.Entity = null; 2251 previousValue. UptimeCalendars.Remove(this);2252 previousValue.Downtimes.Remove(this); 2252 2253 } 2253 2254 this._Resource.Entity = value; 2254 2255 if ((value != null)) 2255 2256 { 2256 value. UptimeCalendars.Add(this);2257 value.Downtimes.Add(this); 2257 2258 this._ResourceId = value.ResourceId; 2258 2259 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
r6431 r6452 129 129 #endregion 130 130 131 #region AppointmentMethods132 DT. Appointment GetAppointment(Guid id);133 IEnumerable<DT. Appointment> GetAppointments(Expression<Func<UptimeCalendar, bool>> predicate);134 Guid Add Appointment(DT.Appointmentdto);135 void Update Appointment(DT.Appointmentdto);136 void Delete Appointment(Guid id);131 #region Downtime Methods 132 DT.Downtime GetDowntime(Guid id); 133 IEnumerable<DT.Downtime> GetDowntimes(Expression<Func<Downtime, bool>> predicate); 134 Guid AddDowntime(DT.Downtime dto); 135 void UpdateDowntime(DT.Downtime dto); 136 void DeleteDowntime(Guid id); 137 137 #endregion 138 138 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Prepare Hive Database.sql
r6431 r6452 73 73 ALTER TABLE dbo.Resource WITH NOCHECK ADD CONSTRAINT [DF_Resource_ResourceId] DEFAULT (NEWSEQUENTIALID()) FOR ResourceId; 74 74 75 ALTER TABLE dbo. UptimeCalendar ALTER COLUMN UptimeCalendarId ADD ROWGUIDCOL;76 ALTER TABLE dbo. UptimeCalendar WITH NOCHECK ADD CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId] DEFAULT (NEWSEQUENTIALID()) FOR UptimeCalendarId;75 ALTER TABLE dbo.Downtime ALTER COLUMN DowntimeId ADD ROWGUIDCOL; 76 ALTER TABLE dbo.Downtime WITH NOCHECK ADD CONSTRAINT [DF_Downtime_DowntimeId] DEFAULT (NEWSEQUENTIALID()) FOR DowntimeId; 77 77 78 78 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs
r6444 r6452 24 24 using HeuristicLab.Services.Hive.Common; 25 25 26 namespace HeuristicLab.Services.Hive.DataAccess { 27 public static class TransactionManager {28 public staticvoid UseTransaction(Action call, bool serializable = false, bool longRunning = false) {26 namespace HeuristicLab.Services.Hive.DataAccess { 27 public class TransactionManager : ITransactionManager { 28 public void UseTransaction(Action call, bool serializable = false, bool longRunning = false) { 29 29 int n = 10; 30 30 while (n > 0) { … … 46 46 } 47 47 48 public staticT UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) {48 public T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) { 49 49 int n = 10; 50 50 while (n > 0) { … … 68 68 } 69 69 70 private staticTransactionScope CreateTransaction(bool serializable, bool longRunning) {70 private TransactionScope CreateTransaction(bool serializable, bool longRunning) { 71 71 var options = new TransactionOptions(); 72 72 if (serializable) … … 76 76 77 77 if (longRunning) 78 options.Timeout = ApplicationConstants.LongRunningDatabaseCommandTimeout;78 options.Timeout = Settings.Default.LongRunningDatabaseCommandTimeout; 79 79 80 80 return new TransactionScope(TransactionScopeOption.Required, options); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/app.config
r5264 r6452 2 2 <configuration> 3 3 <configSections> 4 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 5 <section name="HeuristicLab.Services.Hive.DataAccess.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 6 </sectionGroup> 4 7 </configSections> 5 8 <connectionStrings> 6 <add name="HeuristicLab.Services.Hive.DataAccess.Properties.Settings.HeuristicLab_Hive_LinqConnectionString" connectionString="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.4;Integrated Security=True;" providerName="System.Data.SqlClient"/> 9 <add name="HeuristicLab.Services.Hive.DataAccess.Properties.Settings.HeuristicLab_Hive_LinqConnectionString" 10 connectionString="Data Source=localhost;Initial Catalog=HeuristicLab.Hive-3.4;Integrated Security=True;" 11 providerName="System.Data.SqlClient" /> 7 12 </connectionStrings> 8 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> 13 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup><applicationSettings> 14 <HeuristicLab.Services.Hive.DataAccess.Settings> 15 <setting name="LongRunningDatabaseCommandTimeout" serializeAs="String"> 16 <value>00:05:00</value> 17 </setting> 18 </HeuristicLab.Services.Hive.DataAccess.Settings> 19 </applicationSettings> 20 </configuration>
Note: See TracChangeset
for help on using the changeset viewer.