Added RedirectUsingNamedRoute
[castle.git] / ActiveRecord / Castle.ActiveRecord.Tests / Model / StrictModel / SurveyEstrato.cs
blobc069fa4cab8c45931277c2b9f7c1adeb818a9b61
1 // Copyright 2004-2008 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 [ActiveRecord(DiscriminatorValue="2")]
22 public class SurveyEstrato : Estrato
24 public SurveyEstrato()
28 public SurveyEstrato(SurveyEstrato parentEstrato) : this(parentEstrato, null)
32 public SurveyEstrato(Survey survey) : this(null, survey)
36 public SurveyEstrato(SurveyEstrato parentEstrato, Survey survey)
38 if (survey == null && parentEstrato == null)
40 throw new ArgumentNullException(
41 "You must specify either a survey or a parent estrato " +
42 "in order to create an estrato instance");
45 this.EstratoType = EstratoType.Survey;
47 this.ParentEstrato = parentEstrato;
49 if (survey == null)
51 this.Container = parentEstrato.Survey;
53 else
55 this.Container = survey;
59 public Survey Survey
61 get { return (Survey) Container; }
62 set { Container = value; }
65 #region Static methods
67 public static void DeleteAll()
69 ActiveRecordBase.DeleteAll( typeof(SurveyEstrato) );
72 public static SurveyEstrato Find(int id)
74 return (SurveyEstrato) ActiveRecordBase.FindByPrimaryKey( typeof(SurveyEstrato), id );
77 public static SurveyEstrato[] FindAll()
79 return (SurveyEstrato[]) ActiveRecordBase.FindAll( typeof(SurveyEstrato) );
82 #endregion