Im not even sure you can do this.. having the primarykey inside the the nested object
however, if you are only look to demostrate the Value Object pattern, why not just use the example from Castle http://www.castleproject.org/activerecord/documentation/trunk/usersguide/nested.html Address can be a good example of a Value Object Besides. Value Objects dont have a conceputual identity so that kind of rules of the primarykey thing you are trying to add to the nested object.. On Feb 6, 11:42 am, Flominator <[email protected]> wrote: > > Not quite sure what your plan is :) > > My "teacher" wants me to implement the value object pattern. > > When I tried putting only [Nested] in SystemUser and putting > [PrimaryKey] into SystemUserId it tell me: "A type must declare a > primary key. Check type Messweb.Models.SystemUser.SystemUser" > > I also tried it with komposite keys like mentioned > athttp://www.castleproject.org/ActiveRecord/documentation/v1rc1/usersgu... > But that would demand a lot of modification in the existing > application. Another thing is, that this IS NOT REALLY a composite > key, since only one property is used for the key. > > Any clues? > > //Flo > > On 6 Feb., 11:22, Mark Jensen <[email protected]> wrote: > > > Not quite sure what your plan is :) > > > but have you tried to removing PrimaryKey from this property > > > [Nested("Id"), PrimaryKey] > > public SystemUserId Id > > { > > get { return mId; } > > set { mId = value; } > > } > > > And I also think you need to remove the "id" from the Nested > > attribute, so it will be > > > [Nested] > > public SystemUserId Id > > { > > get { return mId; } > > set { mId = value; } > > } > > > Because if i remember correctly, the value you put into the Nested > > attribute is used as a prefix for column names. > > > /Mark > > > On Feb 6, 8:24 am, Flominator <[email protected]> wrote: > > > > I uploaded it to this > > > google-group:http://groups.google.com/group/castle-project-users/139 > > > > On 5 Feb., 16:47, Simon <[email protected]> wrote: > > > > > Could you provide your SystemUser class. > > > > > //Simon > > > > > On Feb 4, 8:28 am, Flominator <[email protected]> wrote: > > > > > > Hi there, > > > > > > I'm trying to use a nested object as primary key. When I try to > > > > > initialize Active Record I get > > > > > > "Could not determine type for: Messweb.Models.SystemUser.SystemUserId, > > > > > for columns: NHibernate.Mapping.Column(Id)" > > > > > > Is there a way to do this or are my attempts futile? > > > > > > Thanks in advance, > > > > > > Flo > > > > > > PS: I've uploaded my class SystemUser.cs to this group. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
