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
;
22 [ActiveRecord(DiscriminatorValue
="1")]
23 public class ReferenceEstrato
: Estrato
25 public ReferenceEstrato()
29 public ReferenceEstrato(ReferenceEstrato parentEstrato
) : this(parentEstrato
, null)
33 public ReferenceEstrato(Repository repository
) : this(null, repository
)
37 public ReferenceEstrato(ReferenceEstrato parentEstrato
, Repository repository
)
39 if (repository
== null && parentEstrato
== null)
41 throw new ArgumentNullException(
42 "You must specify either a repository or a parent estrato " +
43 "in order to create an estrato instance");
46 this.EstratoType
= EstratoType
.Survey
;
48 this.ParentEstrato
= parentEstrato
;
50 if (repository
== null)
52 this.Container
= parentEstrato
.Repository
;
56 this.Container
= repository
;
60 public Repository Repository
62 get { return (Repository) Container; }
63 set { Container = value; }
66 #region Static methods
68 public static void DeleteAll()
70 ActiveRecordBase
.DeleteAll( typeof(ReferenceEstrato
) );
73 public static ReferenceEstrato
Find(int id
)
75 return (ReferenceEstrato
) ActiveRecordBase
.FindByPrimaryKey( typeof(ReferenceEstrato
), id
);
78 public static ReferenceEstrato
[] FindAll()
80 return (ReferenceEstrato
[]) ActiveRecordBase
.FindAll( typeof(ReferenceEstrato
) );