Can't you just mark your Item class as `abstract`? Then FNH should exclude it from its mapping by default. Without proper subclass-mapping you can't expect NHibernate to fill your `IList<Item> Items`, though; you would have to ignore that property in the mapping and instead fill it with content from specific properties that are casted to Item and added to the Items list.
-- Asbjørn Ulsberg -=|=- [email protected] (mailto:[email protected]) «He's a loathsome offensive brute, yet I can't look away» On fredag 30. september 2011 at 00:28, Keith Nicholas wrote: > I'm having trouble introducing inheritance into an existing database > structure. The existing DB structure is used by legacy apps using native > sql, so I can't change the structure of the existing table, other than > *adding* more things to the table schema. > > > so I have an existing table/class something like this.... > > class Logger > { > public virtual int Id { get; set; } > public virtual Client Client { get; set; } > // plus other things... > } > > with a table, which I can't change or it will break other things, like :- > > create table tblLogger ( > lngLoggerID INT IDENTITY NOT NULL, > lngClientID INT null; > > primary key (lngLoggerID) > ) > > > There are other similar tables..... and what I want to do is introduce a base > class ( or interface ) so that I can put them into a collection > > ie I want to change Logger to be class Logger : Item > > and then I can have a collection of items on some other Entity like... > IList<Item> Items > > So my problem is, if I try to do this, The Logger becomes a subclass of Item > and its Id doesn't work, it wants to map in the Items Id and maintain Id > uniqueness across all subclasses. But I want to keep the Loggers Id (and > that of other legacy tables who also have their own Ids) in tact because I > can't change how that works. > > Any idea how I can map this? > > Regards, > > Keith > > > -- > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > To post to this group, send email to [email protected] > (mailto:[email protected]). > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]). > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" 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/fluent-nhibernate?hl=en.
