| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Model\IMappingHandler.cs | - | - | - | - |
|
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.Reflection; | |
26 | using System.Collections; | |
27 | ||
28 | namespace ShowX.Model | |
29 | { | |
30 | /// <summary> | |
31 | /// Expose a common interface to handle mapping between types and | |
32 | /// ShowX attributes. Mapping can be achieved in two ways: by Custom attributes or | |
33 | /// by mapping files. Custom attributes brings a rigid mapping, since they not | |
34 | /// support views. | |
35 | /// </summary> | |
36 | public interface IMappingHandler | |
37 | { | |
38 | /// <summary> | |
39 | /// Get the property marked as the Primary key of the object, for a given type. | |
40 | /// </summary> | |
41 | /// <param name="t">Type to get PK property.</param> | |
42 | /// <returns>A PropertyInfo instance, representing the PK property.</returns> | |
43 | PropertyInfo GetPK(Type t); | |
44 | ||
45 | /// <summary> | |
46 | /// Get a property marked as foreign key of the object, for a given type. | |
47 | /// </summary> | |
48 | /// <param name="t">Type to get FK property.</param> | |
49 | /// <param name="attrName">Name of the searched property.</param> | |
50 | /// <returns>A PropertyInfo instance, representing the FK property.</returns> | |
51 | PropertyInfo GetFK(Type t, string attrName); | |
52 | ||
53 | /// <summary> | |
54 | /// Get an ShowX property of the object, for a given type. | |
55 | /// </summary> | |
56 | /// <param name="t">Type to get the ShowX property.</param> | |
57 | /// <param name="fieldName">Name of the searched property.</param> | |
58 | /// <returns>A PropertyInfo instance, representing the ShowX property. | |
59 | /// </returns> | |
60 | PropertyInfo GetShowXPropertyByName(Type t, string fieldName); | |
61 | ||
62 | /// <summary> | |
63 | /// Retrieve the showX mapper property attached to this Property. | |
64 | /// </summary> | |
65 | /// <param name="pInfo">Property to query for query for mapper property.</param> | |
66 | /// <returns>The property map attached to this Property.</returns> | |
67 | IPropertyMap GetPropertyMap (PropertyInfo pInfo); | |
68 | ||
69 | /// <summary> | |
70 | /// Get all ShowX Properties marked of the object, for a given type. | |
71 | /// </summary> | |
72 | /// <param name="t">Type to get ShowX properties.</param> | |
73 | /// <returns>An ArrayList of PropertyInfo instances.</returns> | |
74 | ArrayList GetAllShowXProperties (Type t); | |
75 | ||
76 | /// <summary> | |
77 | /// Get the validators associated to a certain property. | |
78 | /// </summary> | |
79 | /// <param name="pInfo">PropertyInfo to get validators.</param> | |
80 | /// <returns>An ArrayList instance, populated with instance of | |
81 | /// XValidate class.</returns> | |
82 | ArrayList GetValidators(PropertyInfo pInfo); | |
83 | ||
84 | /// <summary> | |
85 | /// Get the views collection for a given type. | |
86 | /// </summary> | |
87 | /// <param name="t">Type to get ShowX view collection.</param> | |
88 | /// <returns>A view collection instance.</returns> | |
89 | IViewCollection GetViews(Type t); | |
90 | } | |
91 | } | |
92 |
|