See http://stackoverflow.com/questions/478296/nhibernate-changing-sub-types,
it talks about discriminators, but in principle the answer is the same.

<http://stackoverflow.com/questions/478296/nhibernate-changing-sub-types>--
Mauricio

On Mon, Jul 5, 2010 at 10:59 AM, Pbirkoff <[email protected]> wrote:

> Hi,
>
> I hope my subject is clear, but I'll explain my problem:
>
> I've got two ActiveRecord classes: project and case. Case inherits
> from project with a joined key base.
>
> simplified code (there are actually more/other properties in there,
> don't bother mentioning):
>
> [ActiveRecord("projects", Lazy = false), JoinedBase]
>    public class Project: ActiveRecordValidationBase<Project>
>    {
>        private int _id;
>        [PrimaryKey(PrimaryKeyType.Identity, "id")]
>        public virtual int Id
>        {
>            get { return this._id; }
>            set { this._id = value; }
>        }
>
>       private string _name;
>       public virtual String Name
>        {
>            get { return this._name; }
>            set { this._name = value; }
>        }
>   }
>
>
> [ActiveRecord("cases", Lazy = false)]
>    public class Case: Project
>    {
>        private int _caseId;
>        [JoinedKey("Caseid")]
>        public virtual int CaseId
>        {
>            get { return this._caseId; }
>            set { this._caseId = value; }
>        }
>
>       private string _caseType;
>       public virtual String CaseType
>        {
>            get { return this._caseType; }
>            set { this._caseType= value; }
>        }
>   }
>
>
> Now my problem: Let's say I have a Project with Id 1. Is it possible
> to convert this Project to a Case? How do I get this to work?
>
> Or will I have to delete the Project, and create a Case with the same
> values (although a different Id will be assigned)?
>
> --
> 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]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>

-- 
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