What you describe may be a better candidate for a document database (instead of a relational database) to store heterogeneous attributes. MongoDb is most prolific one I see. RavenDb also seems like an excellent choice for the .net platform. Ayende (Oren) has a number of articles on the "nosql" database options on his blog. This may help you get started.
On Aug 3, 7:52 am, Diego Mijelshon <[email protected]> wrote: > No, NH will not do that. > > Diego > > On Mon, Aug 2, 2010 at 23:57, jimbobmcgee <[email protected]>wrote: > > > OK. I can see possibilities but none quite seem to match. <any /> > > looks like it might come closest (with some changes), but still looks > > like it is going to perform (at least) one SELECT for every <meta- > > value /> it encounters. <dynamic-component /> also seems very close, > > but would require me to use an IDictionary to store values (where the > > keys map to column names within the one table), rather than to store > > strongly-typed classes that access the values (where the classes are > > persisted to their own tables). I also assume that <dynamic- > > component /> will try to return all values defined in the mapping, not > > specific ones. > > > Note that I'm not trying to retrieve sets of data where the properties > > can be different per row, but I am trying to retrieve sets where the > > properties could be different per set. > > > Allowing me to return, fleetingly, to pseudo-code examples (note the / > > psuedo/ aspect here), I am after a means to specify what I want to > > return, have NHibernate generate the SQL to do so and populate the > > component objects for me. > > > (new CompObj()).GetByID(1) returns: > > SELECT id > > FROM comp_objs > > WHERE oid = 1 > > > (new CompObj(new Positional())).GetByID(1) returns: > > SELECT id, x, y > > FROM comp_objs t1 > > LEFT JOIN pos_objs t2 ON t1.oid = t2.oid > > WHERE t1.oid = 1 > > > (new CompObj(new Positional(), new Colored())).GetByID(1) returns: > > SELECT id, x, y, r, g, b > > FROM comp_objs t1 > > LEFT JOIN pos_objs t2 ON t1.oid = t2.oid > > LEFT JOIN col_objs t3 ON t1.oid = t3.oid > > WHERE t1.oid = 1 > > > This does not seem unrealistic to me. Is such generation/mapping > > possible within NHibernate? > > > On Aug 3, 2:56 am, Diego Mijelshon <[email protected]> wrote: > > > NH can support most models based on sane inheritance and composition. > > > It's hard to tell which parts are requirements and which are just > > > implementation ideas... but you can definitely map a CompositeObject > > which > > > has a set or map of inherited CompositeObjects, for example. > > > > Diego > > > > On Mon, Aug 2, 2010 at 22:38, jimbobmcgee <[email protected] > > >wrote: > > > > > I appreciate that it may look like I'm asking a lot but I'm not asking > > > > as much as you might first think; it's just a little tough for me to > > > > conceptualise without some rudamentary example of what I am trying to > > > > achieve (hence the extensive code snippets). I've got the > > > > architecture and design down (at least conceptually), now I'm looking > > > > to see how I might leverage NHibernate given that concept. > > > > > Now, let me see if I can distill the concept/question into something > > > > wih a couple less paragraphs: > > > > > Given an outer POCO object, with a collection member, where each item > > > > of the collection is a different inner POCO object (i.e. stored in > > > > different tables) that has a one-to-one relationship with the outer > > > > POCO (enforced by foreign primary keys), is there a way to configure > > > > NHibernate either so that it understands the join or that it will > > > > generate the SQL to query it, without the specific content of the > > > > collection member being known at design time? > > > > > (Now, to me the above question seems harder to understand than that > > > > with the examples...) > > > > > Your answer, 'probably not', is most likely the correct one, in which > > > > case NHibernate would not be suited for my specific needs. That's no > > > > biggie, it just means I won't be able to use it. I'm not trying to > > > > shoehorn in NHibernate where it will not fit, merely evaluating it > > > > considering my needs. If it were a specific issue I was addressing, > > > > I'm sure I could RTFM; the documentation is hardly incomplete and > > > > there are a wealth of articles out there covering many basic mapping > > > > issues. But having spent a couple of evenings Googling and not being > > > > able to break the question down into terse, boolean logic, I thought > > > > I'd try a higher form of human language interpretation. > > > > > (And, of course, if I were required to use NHibernate and required to > > > > use composite objects, I would consider consulting hours from an > > > > expert NH developer; but for a proof-of-concept piece, not likely). > > > > > On Aug 3, 1:32 am, Diego Mijelshon <[email protected]> wrote: > > > > > On Mon, Aug 2, 2010 at 19:03, jimbobmcgee < > > [email protected] > > > > >wrote: > > > > > > > A colleague of mine has been trying to convince me to use > > NHibernate > > > > > > in an upcoming project ... > > > > > > > [...unhelpful critique...] > > > > > > > Semantics aside, do you think this is something NHibernate could > > help > > > > > > me achieve? If so, what do you think would be the most elegant way > > to > > > > > > do it? > > > > > > Yes... No... Maybe. > > > > > Probably not. > > > > > > In any case (leaving acid humor aside for a second) you are asking > > for > > > > > architecture, design, guidance, and implementation all at once in a > > > > single > > > > > email. > > > > > We can help you with specific issues ("does NH support composite > > keys?" > > > > "how > > > > > do I eagerly load two collections?", "how would you map this > > inheritance > > > > > structure?") > > > > > If you need more than that, you should buy some consulting hours from > > any > > > > of > > > > > the expert NH developers around here. > > > > > > Diego > > > > > -- > > > > 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]<nhusers%[email protected]> > > <nhusers%[email protected]<nhusers%[email protected]> > > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/nhusers?hl=en. > > > -- > > 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]<nhusers%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. -- 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.
