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
.Generator
.Components
.Database
18 using System
.Collections
;
22 public class TableDefinition
24 private ArrayList _hasRelation
= new ArrayList();
25 private DatabaseDefinition _db
;
27 private ActiveRecordDescriptor _relatedDescriptor
;
28 private ColumnDefinitionCollection _columns
= new ColumnDefinitionCollection();
30 public TableDefinition(String name
, DatabaseDefinition db
)
36 public void AddManyRelation(TableDefinition def
)
38 if (!_hasRelation
.Contains(def
))
40 _hasRelation
.Add(def
);
49 public ActiveRecordDescriptor RelatedDescriptor
51 get { return _relatedDescriptor; }
52 set { _relatedDescriptor = value; }
55 public ColumnDefinition
AddColumn( ColumnDefinition column
)
57 _columns
.Add( column
);
61 public ColumnDefinitionCollection Columns
63 get { return _columns; }
66 public IList TablesReferencedByHasRelation
68 get { return _hasRelation; }
71 public DatabaseDefinition DatabaseDefinition
77 public override String
ToString()