Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/01/10 13:58:24 (15 years ago)
Author:
kgrading
Message:

Removed References to HiveLogging and updated the default logging mechanism (#991)

Location:
trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/BaseDao.cs

    r3011 r3578  
    33using System.Linq;
    44using System.Text;
     5using System.Data.Linq;
     6using HeuristicLab.Tracing;
    57
    68namespace HeuristicLab.Hive.Server.LINQDataAccess {
     
    1214    }
    1315
     16    protected void CommitChanges() {
     17      try {
     18        Context.SubmitChanges(ConflictMode.ContinueOnConflict);
     19      } catch (ChangeConflictException e) {
     20        Logger.Warn("Concurrency Exception! " + e.Message);
     21        foreach (ObjectChangeConflict conflict in Context.ChangeConflicts) {         
     22          conflict.Resolve(RefreshMode.KeepChanges);
     23        }
     24      }
     25    }
     26
    1427    public abstract TDatabaseEntity DtoToEntity(TBusiness source, TDatabaseEntity target);
    1528    public abstract TBusiness EntityToDto(TDatabaseEntity source, TBusiness target);
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientConfigDao.cs

    r3011 r3578  
    2626      ClientConfig c = DtoToEntity(bObj, null);
    2727      Context.ClientConfigs.InsertOnSubmit(c);
    28       Context.SubmitChanges();
     28      CommitChanges();
    2929      bObj.Id = c.ClientConfigId;
    3030      return bObj; 
     
    3333    public void Delete(ClientConfigDto bObj) {
    3434      Context.ClientConfigs.DeleteOnSubmit(Context.ClientConfigs.SingleOrDefault(c => c.ClientConfigId.Equals(bObj.Id)));
    35       Context.SubmitChanges();
     35      CommitChanges();
    3636    }
    3737
     
    3939      ClientConfig cc = Context.ClientConfigs.SingleOrDefault(c => c.ClientConfigId.Equals(bObj.Id));
    4040      DtoToEntity(bObj, cc);
    41       Context.SubmitChanges();
     41      CommitChanges();
    4242    }
    4343
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientDao.cs

    r3203 r3578  
    4343      dbclient.UseCalendarFromResourceId = clientGroupId;
    4444      dbclient.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), CalendarState.Fetch);
    45       Context.SubmitChanges();
     45      CommitChanges();
    4646    }
    4747
     
    4949      Client c = DtoToEntity(info, null);     
    5050      Context.Clients.InsertOnSubmit(c);
    51       Context.SubmitChanges();
     51      CommitChanges();
    5252      info.Id = c.ResourceId;
    5353      return info;
     
    5858      Resource res = Context.Resources.SingleOrDefault(c => c.ResourceId.Equals(info.Id));           
    5959      Context.Resources.DeleteOnSubmit(res);
    60       Context.SubmitChanges();
     60      CommitChanges();
    6161    }
    6262
     
    6464      Client client = Context.Clients.SingleOrDefault(c => c.ResourceId.Equals(info.Id));
    6565      DtoToEntity(info, client);
    66       try {
    67         Console.WriteLine("Sending from thread: " + Thread.CurrentThread.ManagedThreadId);
    68         Context.SubmitChanges();
    69       } catch (System.Data.Linq.ChangeConflictException cce) {
    70         Console.WriteLine(cce);       
    71       }
     66      CommitChanges();     
    7267    }
    7368
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientGroupDao.cs

    r3220 r3578  
    3131      ClientGroup cc = DtoToEntity(bObj, null);
    3232      Context.ClientGroups.InsertOnSubmit(cc);
    33       Context.SubmitChanges();
     33      CommitChanges();
    3434      bObj.Id = cc.ResourceId;
    3535      return bObj;
     
    4444
    4545      Context.Resources.DeleteOnSubmit(res);
    46       Context.SubmitChanges();
     46      CommitChanges();
    4747    }
    4848
     
    5050      ClientGroup client = Context.ClientGroups.SingleOrDefault(c => c.ResourceId.Equals(bObj.Id));
    5151      DtoToEntity(bObj, client);
    52       Context.SubmitChanges();
     52      CommitChanges();
    5353    }
    5454
     
    5757      Resource res = Context.Resources.SingleOrDefault(r => r.ResourceId.Equals(resource));
    5858      cg.ClientGroup_Resources.Add(new ClientGroup_Resource { ClientGroup = cg, Resource = res });     
    59       Context.SubmitChanges();
     59      CommitChanges();
    6060    }
    6161
     
    6565          cg => cg.ResourceId.Equals(resource) && cg.ClientGroupId.Equals(clientGroupId));
    6666      Context.ClientGroup_Resources.DeleteOnSubmit(cgr);
    67       Context.SubmitChanges();
     67      CommitChanges();
    6868    }
    6969
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ContextFactory.cs

    r3220 r3578  
    99  public class ContextFactory {
    1010    [ThreadStatic]
    11     private static HiveDataContext _hiveDataContext;
     11    private static HiveDataContext _hiveDataContext = null;
    1212
    1313    [ThreadStatic]
    14     private static SqlTransaction _currentTransaction;
     14    private static SqlTransaction _currentTransaction = null;
    1515
    1616    public static HiveDataContext Context {
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj

    r3220 r3578  
    134134      <Name>HeuristicLab.PluginInfrastructure</Name>
    135135    </ProjectReference>
     136    <ProjectReference Include="..\..\HeuristicLab.Tracing\3.2\HeuristicLab.Tracing-3.2.csproj">
     137      <Project>{EE2034D9-6E27-48A1-B855-42D45F69A4FC}</Project>
     138      <Name>HeuristicLab.Tracing-3.2</Name>
     139    </ProjectReference>
    136140  </ItemGroup>
    137141  <ItemGroup>
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml

    r3203 r3578  
    8888      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
    8989      <Column Name="Percentage" Type="System.Double" DbType="Float" CanBeNull="true" />
    90       <Column Name="SerializedJob" Type="System.Data.Linq.Binary" DbType="VarBinary(MAX)" CanBeNull="true" UpdateCheck="Never" />
     90      <Column Name="SerializedJob" Type="System.Data.Linq.Binary" DbType="VarBinary(MAX)" CanBeNull="true" UpdateCheck="Never" IsDelayLoaded="true" />
    9191      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
    9292      <Column Name="DateCalculated" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs

    r3203 r3578  
    17741774    private System.Nullable<double> _Percentage;
    17751775   
    1776     private System.Data.Linq.Binary _SerializedJob;
     1776    private System.Data.Linq.Link<System.Data.Linq.Binary> _SerializedJob;
    17771777   
    17781778    private System.Nullable<System.DateTime> _DateCreated;
     
    19571957    }
    19581958   
    1959     [Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", CanBeNull=true, UpdateCheck=UpdateCheck.Never)]
     1959    [Column(Storage="_SerializedJob", DbType="VarBinary(MAX)", UpdateCheck=UpdateCheck.Never)]
    19601960    public System.Data.Linq.Binary SerializedJob
    19611961    {
    19621962      get
    19631963      {
    1964         return this._SerializedJob;
    1965       }
    1966       set
    1967       {
    1968         if ((this._SerializedJob != value))
     1964        return this._SerializedJob.Value;
     1965      }
     1966      set
     1967      {
     1968        if ((this._SerializedJob.Value != value))
    19691969        {
    19701970          this.OnSerializedJobChanging(value);
    19711971          this.SendPropertyChanging();
    1972           this._SerializedJob = value;
     1972          this._SerializedJob.Value = value;
    19731973          this.SendPropertyChanged("SerializedJob");
    19741974          this.OnSerializedJobChanged();
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/JobDao.cs

    r3220 r3578  
    2525    }
    2626
     27    public IEnumerable<JobDto> FindWithLimitations(State jobState, int offset, int count) {
     28
     29      IQueryable<JobDto> query = null;
     30      if (jobState == State.finished) {
     31         query = from job in Context.Jobs
     32                 where job.JobState == Enum.GetName(typeof (State), jobState)
     33                 orderby job.DateFinished
     34                 select EntityToDto(job, null);
     35      } else if (jobState == State.calculating || jobState == State.requestSnapshot || jobState == State.requestSnapshotSent) {
     36        query = from job in Context.Jobs
     37                    where job.JobState == Enum.GetName(typeof(State), jobState)
     38                    orderby job.DateCalculated
     39                    select EntityToDto(job, null);
     40      } else {
     41        query = from job in Context.Jobs
     42                    where job.JobState == Enum.GetName(typeof(State), jobState)
     43                    orderby job.DateCreated
     44                    select EntityToDto(job, null);
     45      }
     46
     47      return query.Skip(offset).Take(count).ToList();
     48    }
     49
     50
    2751    public byte[] GetBinaryJobFile(Guid jobId) {
    2852      return (from job in Context.Jobs
     
    3458      Job j = DtoToEntity(bObj, null);
    3559      Context.Jobs.InsertOnSubmit(j);
    36       Context.SubmitChanges();
     60      CommitChanges();
    3761      bObj.Id = j.JobId;
    3862      return bObj;
     
    4569        j.AssignedResources.Add(new AssignedResource { ResourceId = assignRessourceId});
    4670      Context.Jobs.InsertOnSubmit(j);
    47       Context.SubmitChanges();
     71      CommitChanges();
    4872      job.JobInfo.Id = j.JobId;
    4973      return job;
     
    5478      Job job = Context.Jobs.SingleOrDefault(j => j.JobId.Equals(bObj.Id));
    5579      Context.Jobs.DeleteOnSubmit(job);
    56       Context.SubmitChanges();
     80      CommitChanges();
    5781    }
    5882
    5983    public void Update(JobDto bObj) {
    6084      Job job = Context.Jobs.SingleOrDefault(j => j.JobId.Equals(bObj.Id));
    61       DtoToEntity(bObj, job);
    62       try {
    63         Context.SubmitChanges();
    64       } catch (ChangeConflictException cfe) {
    65        
    66       }
     85      DtoToEntity(bObj, job);   
     86      CommitChanges();
    6787    }
    6888
     
    105125      c.Jobs.Add(j);
    106126      j.Client = c;
    107       Context.SubmitChanges();     
     127      CommitChanges();     
    108128    }
    109129
     
    112132      j.Client = null;
    113133      j.JobState = Enum.GetName(typeof(State), State.offline);
    114       Context.SubmitChanges();
     134      CommitChanges();
    115135    }
    116136
     
    137157      target.DateCalculated = source.DateCalculated;
    138158      target.DateCreated = source.DateCreated;
     159      target.DateFinished = source.DateFinished;
    139160      target.JobId = source.Id;
    140161
     
    162183      target.MemoryNeeded = source.MemoryNeeded;
    163184
    164 
    165 
    166185      target.DateCalculated = source.DateCalculated;
    167186      target.DateCreated = source.DateCreated;
     187      target.DateFinished = source.DateFinished;
    168188      target.Id = source.JobId;
    169      
    170          
     189       
    171190      target.Percentage = source.Percentage;
    172191     
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/LINQDataAccessPlugin.cs

    r3011 r3578  
    1111  [PluginDependency("HeuristicLab.Hive.Contracts-3.2")]
    1212  [PluginDependency("HeuristicLab.Hive.Server.DataAccess-3.2")]
     13  [PluginDependency("HeuristicLab.Tracing", "3.2.0")]
    1314  public class LINQDataAccessPlugin: PluginBase {
    1415  }
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/PluginInfoDao.cs

    r3011 r3578  
    2626      PluginInfo pi = DtoToEntity(bObj, null);
    2727      Context.PluginInfos.InsertOnSubmit(pi);
    28       Context.SubmitChanges();
     28      CommitChanges();
    2929      bObj.Id = pi.PluginId;
    3030      return bObj;
     
    3939      PluginInfo pi = Context.PluginInfos.SingleOrDefault(p => p.PluginId.Equals(bObj.Id));
    4040      DtoToEntity(bObj, pi);
    41       Context.SubmitChanges();
     41      CommitChanges();
    4242    }
    4343
     
    5353                                };
    5454          Context.PluginInfos.InsertOnSubmit(dbpi);
    55           Context.SubmitChanges();
     55          CommitChanges();
    5656        }
    5757
     
    6060        rq.PluginInfo = dbpi;
    6161        Context.RequiredPlugins.InsertOnSubmit(rq);
    62         Context.SubmitChanges();
     62        CommitChanges();
    6363      }
     64    }
     65
     66    public List<HivePluginInfoDto> GetPluginDependenciesForJob(JobDto jobDto) {
     67      return (from rp in Context.RequiredPlugins
     68              where rp.JobId.Equals(jobDto.Id)
     69              select EntityToDto(rp.PluginInfo, null)).ToList();
     70     
    6471    }
    6572
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Properties/Settings.Designer.cs

    r2904 r3578  
    2727        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    2828        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
    29         [global::System.Configuration.DefaultSettingValueAttribute("Data Source=SEMTEX-PC;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=" +
     29        [global::System.Configuration.DefaultSettingValueAttribute("Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=" +
    3030            "True")]
    3131        public string HeuristicLab_Hive_LinqConnectionString {
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Properties/Settings.settings

    r2904 r3578  
    66      <DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
    77&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    8   &lt;ConnectionString&gt;Data Source=SEMTEX-PC;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True&lt;/ConnectionString&gt;
     8  &lt;ConnectionString&gt;Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True&lt;/ConnectionString&gt;
    99  &lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
    1010&lt;/SerializableConnectionString&gt;</DesignTimeValue>
    11       <Value Profile="(Default)">Data Source=SEMTEX-PC;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True</Value>
     11      <Value Profile="(Default)">Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True</Value>
    1212    </Setting>
    1313  </Settings>
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs

    r3203 r3578  
    6060      UptimeCalendar uc = DtoToEntity(bObj, null);
    6161      Context.UptimeCalendars.InsertOnSubmit(uc);
    62       Context.SubmitChanges();
     62      CommitChanges();
    6363      bObj.Id = uc.UptimeCalendarId;
    6464      return bObj;
     
    6767    public void Delete(AppointmentDto bObj) {
    6868      Context.UptimeCalendars.DeleteOnSubmit(Context.UptimeCalendars.SingleOrDefault(uc => uc.UptimeCalendarId.Equals(bObj.Id)));
    69       Context.SubmitChanges();
     69      CommitChanges();
    7070    }
    7171
     
    7373      UptimeCalendar cc = Context.UptimeCalendars.SingleOrDefault(c => c.UptimeCalendarId.Equals(bObj.Id));
    7474      DtoToEntity(bObj, cc);
    75       Context.SubmitChanges();
     75      CommitChanges();
    7676    }
    7777
     
    9595      }
    9696
    97       Context.SubmitChanges();           
     97      CommitChanges();           
    9898    }   
    9999
     
    143143      }
    144144     
    145       Context.SubmitChanges();
     145      CommitChanges();
    146146
    147147      //Get all Subgroups
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/VarBinaryStream.cs

    r3220 r3578  
    77using System.Data.SqlClient;
    88using System.Data;
     9using HeuristicLab.Tracing;
    910
    1011namespace HeuristicLab.Hive.Server.LINQDataAccess {
     
    253254
    254255    public void Close() {
     256      Logger.Info("Closing Stream");
    255257      if (_transaction != null) {
    256258        _transaction.Commit();
    257259        _transaction = null;
     260        Logger.Info("Transaction commited and closed");
    258261      }
    259262
     
    262265        ContextFactory.Context.Dispose();
    263266        ContextFactory.Context = null;
     267        Logger.Info("Connection and Context disposed and set null");
    264268      }
    265269    }
  • trunk/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/app.config

    r2904 r3578  
    55    <connectionStrings>
    66        <add name="HeuristicLab.Hive.Server.LINQDataAccess.Properties.Settings.HeuristicLab_Hive_LinqConnectionString"
    7             connectionString="Data Source=SEMTEX-PC;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True"
     7            connectionString="Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True"
    88            providerName="System.Data.SqlClient" />
    99    </connectionStrings>
Note: See TracChangeset for help on using the changeset viewer.