Added RedirectUsingNamedRoute
[castle.git] / ActiveRecord / Castle.ActiveRecord.Framework.Internal.Tests / Model / CompositeKeyForClassWithCompositeKey.cs
blob16c77f03a792f8d826f4360c1b8d916812785c57
1 // Copyright 2004-2008 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.Framework.Internal.Tests.Model
17 using System;
19 [Serializable]
20 public class CompositeKeyForClassWithCompositeKey
22 private string keyA;
23 private string keyB;
25 [KeyProperty]
26 public virtual string KeyA
28 get { return keyA; }
29 set { keyA = value; }
32 [KeyProperty]
33 public virtual string KeyB
35 get { return keyB; }
36 set { keyB = value; }
39 public override string ToString()
41 return string.Join( ":", new string[] { keyA, keyB } );
44 public override bool Equals( object obj )
46 if( obj == this ) return true;
47 if( obj == null || obj.GetType() != this.GetType() ) return false;
48 CompositeKeyForClassWithCompositeKey test = ( CompositeKeyForClassWithCompositeKey ) obj;
49 return ( keyA == test.KeyA || (keyA != null && keyA.Equals( test.KeyA ) ) ) &&
50 ( keyB == test.KeyB || ( keyB != null && keyB.Equals( test.KeyB ) ) );
53 public override int GetHashCode()
55 return keyA.GetHashCode() ^ keyB.GetHashCode();