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
.Tests
.Model
.GenericModel
18 using System
.Collections
;
19 using Iesi
.Collections
.Generic
;
21 [ActiveRecord( "Companies", DiscriminatorColumn
= "type", DiscriminatorType
= "String", DiscriminatorValue
= "company" )]
22 public class Company
: ActiveRecordBase
<Company
>
26 private ISet
<Person
> _people
= new HashedSet
<Person
>();
27 private PostalAddress _address
;
33 public Company( string name
)
53 public PostalAddress Address
55 get { return _address; }
56 set { _address = value; }
59 [HasAndBelongsToMany(Table
= "PeopleCompanies",
60 ColumnRef
= "person_id", ColumnKey
= "company_id" )]
61 public ISet
<Person
> People
63 get { return _people; }
64 set { _people = value; }
69 public class PostalAddress
71 private String _address
;
73 private String _state
;
74 private String _zipcode
;
76 public PostalAddress()
80 public PostalAddress( String address
, String city
,
81 String state
, String zipcode
)
92 get { return _address; }
93 set { _address = value; }
100 set { _city = value; }
106 get { return _state; }
107 set { _state = value; }
111 public String ZipCode
113 get { return _zipcode; }
114 set { _zipcode = value; }