Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / TestSiteARSupport / Model / Account.cs
blob2951da3e204b32e246f50dcb7c463a12f4c1d50b
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 TestSiteARSupport.Model
17 using System;
18 using System.Collections.Generic;
19 using Castle.ActiveRecord;
20 using Castle.Components.Validator;
21 using Iesi.Collections.Generic;
22 using ValidateEmailAttribute=Castle.Components.Validator.ValidateEmailAttribute;
24 [ActiveRecord("TSAS_Account")]
25 public class Account : ActiveRecordValidationBase
27 private int id;
28 private String name;
29 private String email;
30 private String password;
31 private String confirmationpassword;
32 private ProductLicense productLicense;
33 private ISet<AccountPermission> permissions;
34 private IList<User> users = new List<User>();
36 public Account()
40 public Account(string name, string email, string password)
42 this.name = name;
43 this.email = email;
44 this.password = password;
47 [PrimaryKey]
48 public int Id
50 get { return id; }
51 set { id = value; }
54 [Property, ValidateNonEmpty]
55 public string Name
57 get { return name; }
58 set { name = value; }
61 [Property, ValidateNonEmpty, ValidateEmail]
62 public string Email
64 get { return email; }
65 set { email = value; }
68 [Property, ValidateNonEmpty]
69 public string Password
71 get { return password; }
72 set { password = value; }
75 [ValidateSameAs("Password")]
76 public string ConfirmationPassword
78 get { return confirmationpassword; }
79 set { confirmationpassword = value; }
82 [BelongsTo("license_id")]
83 public ProductLicense ProductLicense
85 get { return productLicense; }
86 set { productLicense = value; }
89 [HasAndBelongsToMany(
90 Table="AccountAccountPermission",
91 ColumnRef="permission_id", ColumnKey="account_id", Inverse=false)]
92 public ISet<AccountPermission> Permissions
94 get { return permissions; }
95 set { permissions = value; }
98 [HasMany]
99 public IList<User> Users
101 get { return users; }
102 set { users = value; }
105 public override string ToString()
107 return name;
110 public static Account[] FindAll()
112 return (Account[]) FindAll(typeof(Account));