1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.ActiveRecord
18 using Castle
.ActiveRecord
.Queries
;
21 /// This is used to map between a type to a friendly name that can be used in the queries.
23 /// This attribute is representing an <import/> in the mapping files
26 /// [Import(typeof(SummaryRow), "summary")]
28 [AttributeUsage(AttributeTargets
.Class
| AttributeTargets
.Assembly
, AllowMultiple
= true), Serializable
]
29 public class ImportAttribute
: Attribute
31 private readonly Type type
;
32 private String rename
;
35 /// Initializes a new instance of the <see cref="ImportAttribute"/> class.
37 /// <param name="type">The type.</param>
38 /// <param name="rename">The rename.</param>
39 public ImportAttribute(Type type
, string rename
)
46 /// Gets the type that is being imported
48 /// <value>The type.</value>
51 get { return this.type; }
55 /// Gets or sets the renamed string that will replace the full type name in HQL queries for the specified type.
57 /// <value>The renamed value.</value>
60 get { return rename; }
61 set { rename = value; }