Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/21/09 14:15:37 (15 years ago)
Author:
mkommend
Message:

added code for persisting of ModelType into the database (ticket #756)

Location:
trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Model.cs

    r2326 r2371  
    3232    public Model() {
    3333      targetVariable = default(EntityRef<Variable>);
    34       algorithm = default(EntityRef<Algorithm>);     
     34      algorithm = default(EntityRef<Algorithm>);
    3535    }
    3636
    37     public Model(Variable targetVariable, Algorithm algorithm)
     37    public Model(Variable targetVariable, Algorithm algorithm, ModelType modelType)
    3838      : this() {
    3939      this.targetVariableId = targetVariable.Id;
    4040      this.algorithmId = algorithm.Id;
     41      ModelType = modelType.ToString();
    4142    }
    4243
     
    9495    }
    9596
     97    private string modelType;
     98    [Column(Storage = "modelType", CanBeNull = false)]
     99    public string ModelType {
     100      get { return this.modelType; }
     101      private set { this.modelType = value; }
     102    }
     103
     104    ModelType IModel.ModelType {
     105      get {
     106        if (!Enum.IsDefined(typeof(ModelType), this.modelType))
     107          throw new ArgumentException("ModelType " + modelType + " not declared.");
     108        return (ModelType)Enum.Parse(typeof(ModelType), this.modelType);
     109      }
     110    }
     111
    96112    private string name;
    97113    [Column(Storage = "name", CanBeNull = true)]
  • trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs

    r2370 r2371  
    8484
    8585      using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
    86         m = new Model(target, algo);
     86        m = new Model(target, algo,model.Type);
    8787        m.TrainingSamplesStart = model.TrainingSamplesStart;
    8888        m.TrainingSamplesEnd = model.TrainingSamplesEnd;
Note: See TracChangeset for help on using the changeset viewer.