1 // Copyright 2004-2007 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
.Framework
.Internal
.Tests
.Model
19 using Castle
.ActiveRecord
;
22 public class BadClassWithAnyAttribute
: ActiveRecordBase
26 [PrimaryKey(Access
= PropertyAccess
.NosetterCamelcaseUnderscore
)]
32 [Any(typeof(long), NotNull
= true,
33 TypeColumn
= "BILLING_DETAILS_TYPE",
34 IdColumn
= "BILLING_DETAILS_ID",
35 Cascade
= CascadeEnum
.SaveUpdate
)]
36 // [Any.MetaValue("CREDIT_CARD", typeof (CreditCard))]
37 [Any
.MetaValue("BANK_ACCOUNT", typeof(BankAccount
))]
38 public IPayment PaymentMethod
48 public class ClassWithAnyAttribute
: ActiveRecordBase
52 [PrimaryKey(Access
=PropertyAccess
.NosetterCamelcaseUnderscore
)]
58 [Any(typeof(long), MetaType
=typeof(string), NotNull
=true,
59 TypeColumn
="BILLING_DETAILS_TYPE",
60 IdColumn
="BILLING_DETAILS_ID",
61 Cascade
=CascadeEnum
.SaveUpdate
)]
62 [Any
.MetaValue("BANK_ACCOUNT", typeof(BankAccount
))]
63 public IPayment PaymentMethod
71 public class ClassWithAnyAttributeUsingGenericId
: ActiveRecordBase
75 [PrimaryKey(Access
= PropertyAccess
.NosetterCamelcaseUnderscore
)]
81 [Any(typeof(long?), MetaType
= typeof(string), NotNull
= true,
82 TypeColumn
= "BILLING_DETAILS_TYPE",
83 IdColumn
= "BILLING_DETAILS_ID",
84 Cascade
= CascadeEnum
.SaveUpdate
)]
85 [Any
.MetaValue("BANK_ACCOUNT", typeof(BankAccount
))]
86 public IPayment PaymentMethod
93 public interface IPayment
97 public class CreditCard
: IPayment
101 public class BankAccount
: IPayment
106 public class ClasssWithHasManyToAny
: ActiveRecordBase
110 [PrimaryKey(Access
= PropertyAccess
.NosetterCamelcaseUnderscore
)]
116 [HasManyToAny(typeof (IPayment
), "pay_id", "payments_table", typeof (int), "payment_type", "payment_method_id",
117 MetaType
=typeof (int), RelationType
=RelationType
.Set
)]
118 public IPayment PaymentMethod