#region License Information /* HeuristicLab * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System.Collections.Generic; using System.Runtime.Serialization; using HeuristicLab.Services.OKB.AttributeSelection; using HeuristicLab.Services.OKB.DataAccess; namespace HeuristicLab.Services.OKB { /// /// Data capsule for describing data base fields and /// restrictions. This is the basis for building complex queries. /// [DataContract] public class AttributeSelector : IAttributeSelector { /// /// Gets or sets the name of the table. /// /// The name of the table. [DataMember] public string TableName { get; set; } /// /// Gets or sets the name of the field. /// /// The name of the field. [DataMember] public string FieldName { get; set; } /// /// Gets or sets a value indicating whether this instance is hidden. /// /// true if this instance is hidden; otherwise, false. [DataMember] public bool IsHidden { get; set; } /// /// Gets or sets the min value. /// /// The min value. [DataMember] public object MinValue { get; set; } /// /// Gets or sets the max value. /// /// The max value. [DataMember] public object MaxValue { get; set; } /// /// Gets or sets the allowed values. /// /// The allowed values. [DataMember] public ICollection AllowedValues { get; set; } /// /// Gets or sets the name of the data type. /// /// The name of the data type. [DataMember] public string DataTypeName { get; set; } /// /// Gets an actual implementations linked to the database. /// /// The okb data context. /// A public RunAttributeSelector GetImpl(OKBDataContext okb) { return new RunAttributeSelector(okb, TableName, FieldName) { IsHidden = IsHidden, MinValue = MinValue, MaxValue = MaxValue, AllowedValues = AllowedValues, }; } /// /// Initializes a new instance of the class. /// public AttributeSelector() { } /// /// Initializes a new instance of the class. /// /// The selector. public AttributeSelector(RunAttributeSelector selector) { TableName = selector.TableName; FieldName = selector.FieldName; IsHidden = selector.IsHidden; MinValue = selector.MinValue; MaxValue = selector.MaxValue; AllowedValues = selector.AllowedValues; DataTypeName = selector.DataType.FullName; } } }