Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / CompositeModel / AgentKey.cs
blobf2f737017baaaff9546928edf36935dd7c03a314
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.Tests.Model.CompositeModel
17 using System;
19 [Serializable]
20 public class AgentKey
22 private string orgId;
23 private string name;
25 public AgentKey()
29 public AgentKey(string orgId, string name)
31 this.orgId = orgId;
32 this.name = name;
35 [KeyProperty]
36 public virtual string OrgId
38 get { return orgId; }
39 set { orgId = value; }
42 [KeyProperty]
43 public virtual string Name
45 get { return name; }
46 set { name = value; }
49 public override string ToString()
51 return String.Join(":", new string[] {orgId, name});
54 public override bool Equals(object obj)
56 if (null == obj)
58 return false;
60 if (ReferenceEquals(this, obj))
62 return true;
64 if (!(obj is AgentKey))
66 return false;
68 AgentKey rhs = (AgentKey) obj;
69 return (this.orgId == rhs.orgId || (this.orgId != null && this.orgId.Equals(rhs.orgId))) &&
70 (this.name == rhs.name || (this.name != null && this.name.Equals(rhs.name)));
73 public override int GetHashCode()
75 return (this.orgId.GetHashCode() ^ this.name.GetHashCode());