Haha Krzysztof, you are starting to sound like an Aussie already! Yeah glad you figured out how to do it without static. We don't provide a super easy way to thread your own state into the conventions so using static is the easiest thing to explain.
2011/3/18 Krzysztof Koźmic <[email protected]> > Actually I figured a way of doing this without statics (yuck! You're > asking me to sell my soul mate). > > I'll post it monday when I get back to work. Don't have the code on my > machine. > > > On 19/03/2011 11:45 AM, Paul Batum wrote: > > Okay how about this. > > Write some code to do reflection on your domain model and identify all > these pairs. Stick the list of pairs into some static data structure. Do > this before you configure fluent nhibernate. > > Create conventions that check to see if the particular member they are > running against is a part of a pair by accessing the static data structure. > If so, apply the convention. > > 2011/3/18 Krzysztof Koźmic <[email protected]> > >> Hey Paul, >> >> It's not for a single Foo and Bar pair in the app. >> >> I want that for every bi-directional one-to-many in the app and there are >> quite a few (and that number is going to grow significantly over next few >> months) hence I want this to be a convention that gets automatically applied >> as new classes get added to the app, with no additional coding required. >> >> cheers, >> Krzysztof >> >> >> On 18/03/2011 4:22 PM, Paul Batum wrote: >> >> It looks like you want an IAutomappingOverride. >> >> It looks very similar to a class map, but you just specify your changes >> from the default. >> http://wiki.fluentnhibernate.org/Auto_mapping#Overrides >> >> On Thu, Mar 17, 2011 at 9:20 AM, Krzysztof Kozmic < >> [email protected]> wrote: >> >>> I'm working with Auto Mapping trying to put NHibernate on top of >>> existing Oracle database (yeah, I know - awesome). >>> >>> It basically is the first time I've worked with auto mapping and it's >>> working just fine except I'm not sure how to approach one-to-many >>> mappings. >>> >>> It's simple (pseudocode) >>> >>> class Foo >>> { >>> Bar Bar {get; >>> set >>> { >>> _bar.Foos.Remove(this); >>> _bar = value; >>> _bar.Foos.Add(this); >>> } >>> } >>> } >>> >>> class Bar >>> { >>> IList<Foo> Foos {get;set;} >>> } >>> >>> So basically >>> - how to set up the relation properly with inverse = "true" and all >>> the other gooddies so that NHibernate knows that these properties are >>> both ends of the same relationship >>> - while for all other properties I'm using Property access, in here >>> obviously for the "many" end of the relationship I need to use back >>> field, so how do I do the exception here for those cases >>> - I have many more many-to-one relationships in the model but they are >>> one directional so I need to tell them apart (things like >>> Item.UpdatedByUser etc) >>> - this one I guess is obvious but I'll say this anyway - there are >>> many sets of Foos and Bars like that in the model - so that pseudocode >>> above is just an example of how things are layed down >>> >>> >>> I feel like I'm missing bigger picture. I know of different convention >>> interfaces but they are very fine grained and I feel like to do it >>> right I need information from multiple, not just one. So what am I >>> missing here, how should I go about doing it "the right way". >>> >>> cheers >>> >>> -- >>> 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. >>> >>> >> -- >> 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. >> >> >> -- >> 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. >> > > -- > 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. > > > -- > 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. > -- 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.
