Change to:

    abstract public class Base<T> : ActiveRecordValidationBase<T>
where T : object

Note the 'where T : object' at the end.


 - b


On Jul 20, 2:56 pm, SteamAnger <[email protected]> wrote:
> Maybe I am a bit stupid right now, but I cant figure out how to solve
> my problem. :(
>
> Look at this two classes:
>
> Base.cs
> ======================================
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using Castle.ActiveRecord;
>
> namespace Test
> {
>     [ActiveRecord]
>     abstract public class Base<T> : ActiveRecordValidationBase<T>
>     {
>         [Property]
>         public DateTime Created { get; set; }
>         [Property]
>         public DateTime Modified { get; set; }
>
>         public Base()
>         {
>             Created = DateTime.Now;
>             Modified = DateTime.Now;
>         }
>     }}
>
> ======================================
>
> Item.cs
> ======================================
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using Castle.ActiveRecord;
>
> namespace Test
> {
>     [ActiveRecord]
>     public class Item : Base<Item>
>     {
>         [Property]
>         public string ItemName { get; set; }
>     }}
>
> ======================================
>
> This will not work, the compiler will complain about the inheritance
> in my Base class with the exception message:
>
> The type 'T' must be a reference type in order to use it as parameter
> 'T' in the generic type or method
> 'Castle.ActiveRecord.ActiveRecordValidationBase<T>'
>
> But if I replace to inheritance from ActiveRecordBase<T> instead of
> ActiveRecordValidationBase<T> everything will work. But I cant enable
> the validation from my base class. Help! :)
>
> Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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