Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / ActiveRecord / Castle.ActiveRecord / Framework / Queries / Modifiers / SqlQueryJoinDefinition.cs
blob5ec686818eb6ea661fd24336199df88ea0b225ab
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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.Queries.Modifiers
17 using System;
19 using NHibernate;
21 /// <summary>
22 /// Represents a SQL query join definition.
23 /// See <see cref="NHibernate.ISession.CreateSQLQuery(string,string[],Type[])"/> for more information.
24 /// </summary>
25 public class SqlQueryJoinDefinition : IQueryModifier
27 private readonly String associationPath;
28 private readonly String associationAlias;
30 /// <summary>
31 /// Initializes a new instance of the <see cref="SqlQueryJoinDefinition"/> class.
32 /// </summary>
33 /// <param name="associationPath">The association path.</param>
34 /// <param name="associationAlias">The association alias.</param>
35 public SqlQueryJoinDefinition(String associationPath, String associationAlias)
37 if (associationPath == null) throw new ArgumentNullException("associationPath");
38 if (associationAlias == null) throw new ArgumentNullException("associationAlias");
40 this.associationPath = associationPath;
41 this.associationAlias = associationAlias;
44 /// <summary>
45 /// Gets the path of the assocation
46 /// </summary>
47 public String AssociationPath
49 get { return associationPath; }
52 /// <summary>
53 /// Gets the alias for the association
54 /// </summary>
55 public String AssociationAlias
57 get { return associationAlias; }
60 #region "Apply" method
62 /// <summary>
63 /// Applies this modifier to the query.
64 /// </summary>s
65 /// <param name="query">The query</param>
66 void IQueryModifier.Apply(IQuery query)
68 ISQLQuery sqlQuery = query as ISQLQuery;
70 if (sqlQuery != null)
72 sqlQuery.AddJoin(associationAlias, associationPath);
76 #endregion