#region Apache Notice /***************************************************************************** * $Header: $ * $Revision: 383115 $ * $Date$ * * iBATIS.NET Data Mapper * Copyright (C) 2008/2005 - The Apache Software Foundation * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ********************************************************************************/ #endregion #region Imports using System; using System.Diagnostics; using Apache.Ibatis.DataMapper.Model.ResultMapping; using Apache.Ibatis.DataMapper.Model.Sql.External; #endregion namespace Apache.Ibatis.DataMapper.Model.Statements { /// /// Represent a SelectKey tag element. /// [Serializable] [DebuggerDisplay("SelectKey: {SelectKeyType}-{PropertyName}")] public class SelectKey : Statement { [NonSerialized] private readonly SelectKeyType selectKeyType = SelectKeyType.post; [NonSerialized] private readonly string propertyName = string.Empty; #region Properties /// /// Extend statement attribute /// public override string ExtendStatement { get { return string.Empty; } } /// /// The property name object to fill with the key. /// public string PropertyName { get { return propertyName; } } /// /// The type of the selectKey tag : 'Pre' or 'Post' /// public SelectKeyType SelectKeyType { get { return selectKeyType; } } /// /// True if it is a post-generated key. /// public bool isAfter { get { return selectKeyType == SelectKeyType.post; } } #endregion /// /// Initializes a new instance of the class. /// /// The id. /// Name of the property. /// The type. /// The result maps. /// Type of the select key. /// The SQL source. /// Preserve whitespace. public SelectKey( string id, string propertyName, Type type, ResultMapCollection resultMaps, SelectKeyType selectKeyType, ISqlSource sqlSource, bool preserveWhitespace ) : base(id, null, null, type, resultMaps, null, null, null, false, string.Empty, sqlSource, preserveWhitespace) { this.propertyName = propertyName; this.selectKeyType = selectKeyType; } } }