| |||||||||||||||||
| Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
| Model\XmlModel\XmlIdentifierMap.cs | - | 80,0 % | 33,3 % | 54,5 % |
|
||||||||||||
| 1 | #region Copyright | |
| 2 | /* | |
| 3 | ShowX. Maps business objects into presentation layer. | |
| 4 | Copyright (C) 2005 Jesus Diaz. | |
| 5 | ||
| 6 | This library is free software; you can redistribute it and/or | |
| 7 | modify it under the terms of the GNU Lesser General Public | |
| 8 | License as published by the Free Software Foundation; either | |
| 9 | version 2.1 of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | This library is distributed in the hope that it will be useful, | |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | Lesser General Public License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Lesser General Public | |
| 17 | License along with this library; if not, write to the Free Software | |
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
| 19 | ||
| 20 | For project details see: http://showx.sourceforge.net | |
| 21 | */ | |
| 22 | #endregion | |
| 23 | ||
| 24 | using System; | |
| 25 | using System.Xml; | |
| 26 | ||
| 27 | namespace ShowX.Model.XmlModel | |
| 28 | { | |
| 29 | /// <summary> | |
| 30 | /// Represents a property that returns a unique (integer) identifier for the | |
| 31 | /// instance. | |
| 32 | /// </summary> | |
| 33 | /// <remarks>This attribute is mandatory in the definition of the class, because | |
| 34 | /// Object Handler methods like <see cref="IObjectHandler.GetXByID"/> and | |
| 35 | /// <see cref="IObjectHandler.UpdateX"/> | |
| 36 | /// depends on the existence of this value to work properly.</remarks> | |
| 37 | public class XmlIdentifierMap : XmlPropertyMap, IIdentifierMap | |
| 38 | { | |
| 39 | /// <summary> | |
| 40 | /// Represent the name of a substitute property for this primary key property. | |
| 41 | /// As many times we don't want to show identifiers of our objects, the | |
| 42 | /// primary key property can define a substitute property, that will be | |
| 43 | /// show instead of it. | |
| 44 | /// </summary> | |
| 45 | protected string substituteAttr = ""; | |
| 46 | ||
| 47 | /// <summary> | |
| 48 | /// Constructor. Set to true the readOnly value. Set to false the | |
| 49 | /// editOnInset value. | |
| 50 | /// </summary> | |
| 51 | 28 | public XmlIdentifierMap (Type t, XmlNode propertyNode) : base(t,propertyNode) |
| 52 | { | |
| 53 | 28 | this.readOnly = true; |
| 54 | 28 | this.editOnInsert = false; |
| 55 | 28 | this.substituteAttr = XmlPropertyMap.LoadValueFromAttribute( |
| 56 | propertyNode.Attributes[XmlMappingFileConst.propertySustituteAttr] | |
| 57 | ,this.substituteAttr); | |
| 58 | } | |
| 59 | ||
| 60 | #region IIdentifierMap Members | |
| 61 | ||
| 62 | /// <summary> | |
| 63 | /// Reflex the <see cref="substituteAttr"/> field. | |
| 64 | /// </summary> | |
| 65 | public string SubstituteAttr | |
| 66 | { | |
| 67 | 310 | get { return substituteAttr; } |
| 68 | 0 | set { this.substituteAttr = value; } |
| 69 | } | |
| 70 | ||
| 71 | #endregion | |
| 72 | ||
| 73 | /// <summary> | |
| 74 | /// Override the inherited ReadOnly property, so the value of the field | |
| 75 | /// readOnly can't be altered. | |
| 76 | /// </summary> | |
| 77 | 0 | public override bool ReadOnly |
| 78 | { | |
| 79 | set {} | |
| 80 | } | |
| 81 | ||
| 82 | /// <summary> | |
| 83 | /// Override the inherited EditOnInsert property, so the value of the field | |
| 84 | /// editOnInsert can't be altered. | |
| 85 | /// </summary> | |
| 86 | 0 | public override bool EditOnInsert |
| 87 | { | |
| 88 | set {} | |
| 89 | } | |
| 90 | ||
| 91 | /// <summary> | |
| 92 | /// Override the inherited IsPassword property, so the value of the field | |
| 93 | /// isPassword can't be altered. | |
| 94 | /// </summary> | |
| 95 | 0 | public override bool IsPassword |
| 96 | { | |
| 97 | set {} | |
| 98 | } | |
| 99 | } | |
| 100 | } | |
| 101 |
|
||||||||