Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Experiments / Generator / Generators / Model / Templates / Model.cs
blob4ff339e20d07d8aa9c1e3dd99f5b44c24780ca2a
1 using System;
2 using System.Collections;
3 using Castle.ActiveRecord;
5 namespace <%= Namespace %>
7 /// <summary>
8 /// An instance of this class represents a <%= Name %>.
9 /// </summary>
10 [ActiveRecord]
11 public class <%= ClassName %> : ActiveRecordValidationBase<% if UseGeneric: %><%= "<" + ClassName + ">" %><% end %>
13 #region Fields
14 private int _id;
15 <% for field in Fields: %>
16 private string _<%= field.ToLower() %>;
17 <% end %>
18 #endregion
20 #region Persistent properties
21 [PrimaryKey]
22 public int Id {
23 get { return _id; }
24 set { _id = value; }
26 <% i=0; for prop in Properties: %>
27 [Property]
28 public string <%= prop %> {
29 get { return _<%= Fields[i] %>; }
30 set { _<%= Fields[i++] %> = value; }
32 <% end %>
33 #endregion
35 <% if not UseGeneric: %>
36 #region Finders
37 public static <%= ClassName %>[] FindAll()
39 return ((<%= ClassName %>[]) (ActiveRecordBase.FindAll(typeof(<%= ClassName %>))));
42 public static <%= ClassName %> Find(int id)
44 return ((<%= ClassName %>) (ActiveRecordBase.FindByPrimaryKey(typeof(<%= ClassName %>), id)));
46 #endregion
47 <% end %>