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
.StrictModel
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
;
51 this.Container
= parentEstrato
.Survey
;
55 this.Container
= 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
) );