Static methods are not polymorphic, so in fact when you write
ForumTopic.FindAll() you're actually calling ForumPost.FindAll().

Use ActiveRecordMediator<ForumTopic>.FindAll() instead.

On Feb 28, 9:16 am, Pbirkoff <[email protected]> wrote:
> I want to use Single-Table Inheritance, but I got the following
> problem:
>
> I got two classes, ForumPost and ForumTopic. ForumTopic extends
> ForumPost.
>
> ForumPost looks like this:
>
> [ActiveRecord("forum_posts",
>         DiscriminatorColumn = "post_type",
>         DiscriminatorType = "String",
>         DiscriminatorValue = "post", Lazy = true)]
>     [Serializable]
>     public class ForumPost : ActiveRecordBase<ForumPost>
>     {
>          ...methods and properties
>     }
>
> ForumPost looks like this:
>
> [ActiveRecord(DiscriminatorValue = "topic", Proxy =
> typeof(ForumTopic), Lazy = false)]
>
>     public class ForumTopic : ForumPost
>     {
>          ...methods and properties
>     }
>
> The problem is, When I Call ForumTopic.FindAll(), I get a Array of
> ForumPost (ForumPost[]), not ForumTopic[]..
> When I try to cast the ForumPost[] to ForumTopic[], it returns null.
>
> However, the documentation says:
>
> "Each class can have its own FindAll, DeleteAll, only affecting its
> subset of records on the same table."
>
> Any idea how to get a Array of ForumTopic back?

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to