I think you are on the right track. yes, you need to define the columns in the property mapping, and these properties will also play a role in the implementation. I would first start with mapping via IUserType. once this is working and you understand how it works, you can implement ICompositeUserType which should allow you to query properties of the payment type.
On Nov 20, 4:13 pm, "[email protected]" <[email protected]> wrote: > Hmmm..... are there any examples out there for this scenario? > > If not, can you sketch how it might be achieved because there are some > details that I'm fuzzy on. > > If one uses IUserType I won't be able to query > on the properties and so suppose I implement ICompositeUserType > for the ValueObject PaymentMethod to be used like this > > class Subscription { > public PaymentMethod PaymentMethod { get; set; } > > } > > class PaymentMethod > > class CreditCard : PaymentMethod > > class ECheck : PaymentMethod > > so a given subcription I would like the correct type of > instance to be returned. (e.g.CreditCard or an ECheck) > and when I query. > > One of the details I'm confused about is based on my understanding > would I have to, in the property mapping, list all the columns > involved in mapping > each class e.g. > > <property name="" class="PaymentMethodCustomType> > <column name="CardNumber"/> > <column name="Expiration"/> > <column name="CSC"/> > ..... > <column name="CheckAccountNumber"/> > <column name="RoutingNumber"/> > ..... > > </property> > > and in the GetProperties Method I would list all of the Properties in > every class? > Is that right? > > Lastly, this seems like a straight forward use case for mapping, but > not obvious > as to how to map the model. Why? Perhaps this should be a feature or > maybe > the difficulty is telling me my modeling is off. If so, does anyone > have any insights? > > Cheers, > Aeden > > On Nov 20, 5:16 am, Jason Meckley <[email protected]> wrote: > > > components do not allow for polymorphism. you need to implement your > > own IUserType to manage PaymentType. You're other option is to map > > PaymentType to an entity (requires db schema change.) > > > On Nov 20, 2:04 am, "[email protected]" > > > <[email protected]> wrote: > > > I have what appears to be a common and simple model. I have a > > > Subscription entity which contains the value object PaymentMethod. > > > The PaymentMethods are CreditCard or ECheck. I map the Subscription > > > class as an entity and I would like to map the PaymentMethod has a > > > component, but component mappings don't support polymorphism. Or do > > > they? How do other people handle this? Or is there something wrong > > > with the modeling? > > > > Cheers, > > > Aeden- Hide quoted text - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=.
