Hi there,
First of all: sorry for my English, it could sound a little "broken". :-)
Here is my scenario: in an appointment scheduling system, a registered
user or an anonymous guest can book an appointment. In "my world", the
OO design would lead to:
interface IAttendant { ... }
class Appointment {
public Appointment(IAttendant a, ...) { ... }
IAttendant Attendant { ... }
}
class User : IAttendant { ... }
class Guest : IAttendant { ... }
In the "real world" I have:
- The Guest class which persist on "my" db, the Id is of type Int64.
- The User class which persist on a linked server (I'm on SQL Server),
on which I have a view; the Id is a *string*.
As far as I could get, following this
http://nhforge.org/doc/nh/en/index.html#inheritance-tableperconcreate-polymorphism
and
I can define my Guest table and map my User view, and perform
polymorphic queries on my db (I'm using Linq) without any problem.
Something make me think that this isn't true if the Id are of
different types. :-) So, I'm asking:
1. what would you do in such a scenario?
2. is there any way to use implicit polymorphism on an interface, with
implementors having Id of different types?
3. is it possible to declare an Id of type 'Object' and then use a
custom type to map it to an int32, guid, string, ecc ecc... like I've
already done following this example?
http://zvolkov.com/blog/post/2009/08/13/Generic-EnumString-Mapping-in-NHibernate-21.aspx
I guess the answer is yes so... what should I google for? ;-)
In the end, I thought to map the 'Attendant' property of the
'Appointment' class using <any>. the NHibernate reference is
explanatory, but actually I think I lack some basics concepts. For
instance
1. in my scenario, what should I place in the @id-type attribute, as
the two classes have different Id types?
2. I must admit I didn't properly get the meaning of the @meta-type
attribute. Could anyone give me an hint or suggest me some link? In my
case, which value should I set for this attribute?
thanks in advance,
Giulio
--
--
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=en.