Changeset 2194 for branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2
- Timestamp:
- 07/28/09 15:29:10 (15 years ago)
- Location:
- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact
- Files:
-
- 2 deleted
- 10 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Algorithm.cs
r2185 r2194 6 6 using System.Text; 7 7 8 namespace HeuristicLab.Modeling. SQLServerCompactBackend{8 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 9 9 [Table(Name = "Algorithm")] 10 public class Algorithm {10 public class Algorithm : IAlgorithm { 11 11 public Algorithm() { 12 12 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariable.cs
r2185 r2194 5 5 using System.Text; 6 6 7 namespace HeuristicLab.Modeling. SQLServerCompactBackend{7 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 8 8 [Table(Name = "InputVariable")] 9 public class InputVariable {9 public class InputVariable : IInputVariable { 10 10 public InputVariable() { 11 11 this.model = default(EntityRef<Model>); … … 27 27 if (variable.HasLoadedOrAssignedValue) 28 28 throw new ForeignKeyReferenceAlreadyHasValueException(); 29 variableId = value; 29 variableId = value; 30 30 } 31 31 } … … 34 34 private EntityRef<Variable> variable; 35 35 [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)] 36 public Variable Variable {36 public IVariable Variable { 37 37 get { return variable.Entity; } 38 38 } … … 53 53 private EntityRef<Model> model; 54 54 [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)] 55 public Model Model {55 public IModel Model { 56 56 get { return model.Entity; } 57 57 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariableResult.cs
r2185 r2194 5 5 using System.Text; 6 6 7 namespace HeuristicLab.Modeling. SQLServerCompactBackend{7 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 8 8 [Table(Name="InputVariableResult")] 9 public class InputVariableResult {9 public class InputVariableResult : IInputVariableResult { 10 10 public InputVariableResult() { 11 11 this.model = default(EntityRef<Model>); … … 16 16 public InputVariableResult(InputVariable inputVariable, Result result, double value) 17 17 : this() { 18 this.variable.Entity = inputVariable.Variable;19 this.model.Entity = inputVariable.Model;18 this.variable.Entity = (Variable)inputVariable.Variable; 19 this.model.Entity = (Model)inputVariable.Model; 20 20 this.result.Entity = result; 21 21 this.value = value; … … 37 37 private EntityRef<Variable> variable; 38 38 [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)] 39 public Variable Variable {39 public IVariable Variable { 40 40 get { return variable.Entity; } 41 41 } … … 56 56 private EntityRef<Model> model; 57 57 [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)] 58 public Model Model {58 public IModel Model { 59 59 get { return model.Entity; } 60 60 } … … 75 75 private EntityRef<Result> result; 76 76 [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)] 77 public Result Result {77 public IResult Result { 78 78 get { return result.Entity; } 79 79 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Model.cs
r2190 r2194 6 6 using System.Text; 7 7 8 namespace HeuristicLab.Modeling. SQLServerCompactBackend{8 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 9 9 [Table(Name = "Model")] 10 10 public class Model : IModel{ … … 14 14 } 15 15 16 public Model(Variable targetVariable, Algorithm algorithm, byte[] model)16 public Model(Variable targetVariable, Algorithm algorithm, byte[] data) 17 17 : this() { 18 18 this.TargetVariable = targetVariable; 19 19 this.Algorithm = algorithm; 20 this. modelData = model;20 this.Data = data; 21 21 } 22 22 … … 28 28 } 29 29 30 private byte[] modelData;30 private byte[] data; 31 31 [Column(Storage = "model", DbType = "image", CanBeNull = false)] 32 public byte[] ModelData {33 get { return this. modelData; }34 set { this. modelData = value; }32 public byte[] Data { 33 get { return this.data; } 34 set { this.data = value; } 35 35 } 36 36 … … 50 50 private EntityRef<Algorithm> algorithm; 51 51 [Association(Storage = "algorithm", ThisKey = "AlgorithmId", OtherKey = "Id", IsForeignKey = true)] 52 public Algorithm Algorithm {52 public IAlgorithm Algorithm { 53 53 get { return this.algorithm.Entity; } 54 set {54 private set { 55 55 Algorithm previousValue = algorithm.Entity; 56 56 if (previousValue != value || (!algorithm.HasLoadedOrAssignedValue)) { … … 58 58 algorithm.Entity = null; 59 59 } 60 algorithm.Entity = value;60 algorithm.Entity = (Algorithm)value; 61 61 if (value != null) { 62 algorithmId = value.Id;62 algorithmId = ((Algorithm)value).Id; 63 63 } 64 64 } … … 81 81 private EntityRef<Variable> targetVariable; 82 82 [Association(Storage = "targetVariable", ThisKey = "TargetVariableId", OtherKey = "Id", IsForeignKey = true)] 83 public Variable TargetVariable {83 public IVariable TargetVariable { 84 84 get { return this.targetVariable.Entity; } 85 set {85 private set { 86 86 Variable previousValue = targetVariable.Entity; 87 87 if (previousValue != value || (!targetVariable.HasLoadedOrAssignedValue)) { … … 89 89 targetVariable.Entity = null; 90 90 } 91 targetVariable.Entity = value;91 targetVariable.Entity = (Variable)value; 92 92 if (value != null) { 93 targetVariableId = value.Id;93 targetVariableId = ((Variable)value).Id; 94 94 } 95 95 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelResult.cs
r2185 r2194 5 5 using System.Text; 6 6 7 namespace HeuristicLab.Modeling. SQLServerCompactBackend{7 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 8 8 [Table(Name = "ModelResult")] 9 9 public class ModelResult { -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Problem.cs
r2185 r2194 7 7 using HeuristicLab.DataAnalysis; 8 8 9 namespace HeuristicLab.Modeling. SQLServerCompactBackend{9 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 10 10 [Table(Name = "Problem")] 11 11 public class Problem { -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Result.cs
r2190 r2194 6 6 using System.Text; 7 7 8 namespace HeuristicLab.Modeling. SQLServerCompactBackend{8 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 9 9 [Table(Name = "Result")] 10 10 public class Result : IResult { -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Variable.cs
r2185 r2194 6 6 using System.Text; 7 7 8 namespace HeuristicLab.Modeling. SQLServerCompactBackend{8 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 9 9 [Table(Name = "Variable")] 10 public class Variable {10 public class Variable : IVariable{ 11 11 public Variable() { 12 12 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs
r2190 r2194 9 9 using HeuristicLab.GP.StructureIdentification; 10 10 using HeuristicLab.Data; 11 12 namespace HeuristicLab.Modeling.SQLServerCompactBackend { 11 using System.Data.Linq; 12 13 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 13 14 public class DatabaseService : IModelingDatabase { 14 15 … … 29 30 } 30 31 31 public void Persist( IAlgorithm algorithm) {32 public void Persist(HeuristicLab.Modeling.IAlgorithm algorithm) { 32 33 int trainingSamplesStart = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesStart", false)).Data; 33 34 int trainingSamplesEnd = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesEnd", false)).Data; … … 179 180 180 181 public IEnumerable<IResult> GetAllResults() { 181 throw new NotImplementedException(); 182 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 183 return ctx.Results.AsEnumerable().Cast<IResult>(); 184 } 182 185 } 183 186 … … 186 189 #region ModelResult 187 190 public IEnumerable<IModelResult> GetModelResults(IModel model) { 188 throw new NotImplementedException(); 191 ModelingDataContext ctx = new ModelingDataContext(connection); 192 DataLoadOptions dlo = new DataLoadOptions(); 193 dlo.LoadWith<ModelResult>(mr => mr.Model); 194 dlo.LoadWith<ModelResult>(mr => mr.Result); 195 ctx.LoadOptions = dlo; 196 197 var results = from result in ctx.ModelResults 198 where result.Model == model 199 select result; 200 return results.AsEnumerable().Cast<IModelResult>(); 189 201 } 190 202 #endregion 191 203 192 204 #region Model 193 public IEnumerable<I DatabaseModel> GetAllModels() {194 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 195 return ctx.Models ;205 public IEnumerable<IModel> GetAllModels() { 206 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 207 return ctx.Models.AsEnumerable().Cast<IModel>(); 196 208 } 197 209 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/HeuristicLab.Modeling.Database.SQLServerCompact-3.2.csproj
r2191 r2194 6 6 <ProductVersion>9.0.30729</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 <ProjectGuid>{ 9B4F7D05-CCE1-45BB-81D1-5D4925851901}</ProjectGuid>8 <ProjectGuid>{EC1AA756-D612-4FA6-AA52-25CF4F8E3836}</ProjectGuid> 9 9 <OutputType>Library</OutputType> 10 10 <AppDesignerFolder>Properties</AppDesignerFolder> 11 <RootNamespace>HeuristicLab.Modeling. SQLServerCompactBackend</RootNamespace>12 <AssemblyName>HeuristicLab.Modeling. SQLServerCompactBackend-3.2</AssemblyName>11 <RootNamespace>HeuristicLab.Modeling.Database.SQLServerCompact</RootNamespace> 12 <AssemblyName>HeuristicLab.Modeling.Database.SQLServerCompact-3.2</AssemblyName> 13 13 <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> 14 14 <FileAlignment>512</FileAlignment> … … 103 103 <Name>HeuristicLab.GP.StructureIdentification-3.3</Name> 104 104 </ProjectReference> 105 <ProjectReference Include="..\..\HeuristicLab.Modeling.Database\3.2\HeuristicLab.Modeling.Database-3.2.csproj"> 106 <Project>{E84E5717-79F8-498F-A5E0-A055C4EC086B}</Project> 107 <Name>HeuristicLab.Modeling.Database-3.2</Name> 108 </ProjectReference> 105 109 <ProjectReference Include="..\..\HeuristicLab.Modeling\3.2\HeuristicLab.Modeling-3.2.csproj"> 106 110 <Project>{80F7FADA-549D-4151-8856-79B620A50DBA}</Project> -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/ModelingDataContext.cs
r2185 r2194 6 6 using System.Text; 7 7 8 namespace HeuristicLab.Modeling. SQLServerCompactBackend{8 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 9 9 public class ModelingDataContext : DataContext{ 10 10 public ModelingDataContext(string connection)
Note: See TracChangeset
for help on using the changeset viewer.