Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / StrictModel / QuestionContainer.cs
bloba94dbb808651116cf637e77a50a50ffb690e3096
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 ContainerType
23 Abstract,
24 Repository,
25 Survey
28 [ActiveRecord(DiscriminatorColumn="type", DiscriminatorType="Int16", DiscriminatorValue="0")]
29 public class QuestionContainer : ActiveRecordValidationBase
31 private int id;
32 private ContainerType type;
33 private ISet estratos = new ListSet();
35 public QuestionContainer()
39 [PrimaryKey]
40 public int Id
42 get { return id; }
43 set { id = value; }
46 [Property("type", Insert=false, Update=false)]
47 public ContainerType Type
49 get { return type; }
50 set { type = value; }
53 [HasMany( typeof(Estrato), Inverse=true)]
54 public ISet Estratos
56 get { return estratos; }
57 set { estratos = value; }
60 public static void DeleteAll()
62 ActiveRecordBase.DeleteAll( typeof(QuestionContainer) );
65 public static QuestionContainer Find(int id)
67 return (QuestionContainer) ActiveRecordBase.FindByPrimaryKey( typeof(QuestionContainer), id );
70 public override bool Equals(object obj)
72 QuestionContainer rhs = obj as QuestionContainer;
73 if (rhs != null)
75 return rhs.id == id;
77 return false;
80 public override int GetHashCode()
82 return id.GetHashCode();