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
.AnyModel
18 using System
.Collections
;
20 [ActiveRecord("Orders")]
21 public class Order
: ActiveRecordBase
24 private IList _payments
;
37 [HasManyToAny(typeof(IPayment
), "pay_id", "payments_table", typeof(int),
38 "Billing_Details_Type", "Billing_Details_Id", MetaType
= typeof(string))]
39 [Any
.MetaValue("CREDIT_CARD", typeof(CreditCards
))]
40 [Any
.MetaValue("BANK_ACCOUNT", typeof(BankAccounts
))]
43 get { return _payments; }
44 set { _payments = value; }
49 public class CreditCards
: ActiveRecordBase
, IPayment
66 [BelongsTo("ref_order")]
69 get { return _order; }
70 set { _order = value; }
82 public class BankAccounts
: ActiveRecordBase
, IPayment
100 [BelongsTo("ref_order")]
103 get { return _order; }
104 set { _order = value; }
111 set { name = value; }
117 get { return credit; }
118 set { credit = value; }
122 public interface IPayment
125 Order Order { get; set; }
129 public class ModelWithInCorrectMapping
: ActiveRecordBase
131 private string payment
;
133 [Any
.MetaValue("CREDIT_CARD", typeof(CreditCards
))]
134 [Any
.MetaValue("BANK_ACCOUNT", typeof(BankAccounts
))]
135 public string Payment
137 get { return payment; }
138 set { payment = value; }