Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / StrictModel / Estrato.cs
blobe33308d922c92991d8b73b48f208a1bd645bc437
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.StrictModel
17 using System;
19 using Iesi.Collections;
21 public enum EstratoType
23 Abstract,
24 Reference,
25 Survey
28 [ActiveRecord(DiscriminatorColumn="type", DiscriminatorType="Int16", DiscriminatorValue="0")]
29 public class Estrato : ActiveRecordValidationBase
31 private int id;
32 private EstratoType type;
33 private QuestionContainer container;
34 private Estrato parentEstrato;
35 private ISet subestratos = new ListSet();
36 private ISet references = new ListSet();
38 public Estrato()
42 [PrimaryKey]
43 public int Id
45 get { return id; }
46 set { id = value; }
49 [Property("type", Insert=false, Update=false)]
50 public EstratoType EstratoType
52 get { return type; }
53 set { type = value; }
56 [BelongsTo("container_id")]
57 public QuestionContainer Container
59 get { return container != null ? container : ParentEstrato.Container; }
60 set { container = value; }
63 [HasAndBelongsToMany( typeof(Estrato), Table="EstratoRefEstrato", ColumnRef="ref_estrato_id", ColumnKey="estrato_id" )]
64 public ISet ReferencedEstratos
66 get { return references; }
67 set { references = value; }
70 [BelongsTo("parent_id", Type=typeof(Estrato))]
71 public Estrato ParentEstrato
73 get { return parentEstrato; }
74 set { parentEstrato = value; }
77 [HasMany( typeof(Estrato), Inverse=true, Cascade=ManyRelationCascadeEnum.All)]
78 public ISet SubEstratos
80 get { return subestratos; }
81 set { subestratos = value; }
84 public bool IsLeaf
86 get { return SubEstratos == null || SubEstratos.Count == 0; }