James,
Gotcha. Sorry, must be brain drain. By the way you can have the extension method as I have written it with the same name, it doesn't conflict. I know it may be a bit hacky but would you object to bunging the extension method in the trunk. I know it is a little bit hacky but it seems to me that this would satisfy both Jon's and Pauls suggestions without breaking the existing base or the conventions. Martin From: fluent-nhibernate@googlegroups.com [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory Sent: 30 March 2009 17:54 To: fluent-nhibernate@googlegroups.com Subject: [fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap Martin: It wouldn't, it's the lack of the collection that affects the conventions. We used to have two methods ColumnName, and ColumnNames, both were cumulative and resulted in you being unable to effectively use conventions to specify the column name. Your convention would just end up adding a column to the existing one. The ColumnName was removed, and ColumnNames was turned into a property representing the collection; it's obvious now that ColumnName could've been repurposed and shouldn't have been removed, but the params method would now conflict with the property. Either way though, the idea of an extension method is a useful suggestion for if you don't agree with my decision. You'll just have to call it something other than ColumnNames though, because that'll conflict. On Mon, Mar 30, 2009 at 4:48 PM, Martin Hornagold <martin.hornag...@marstangroup.com> wrote: Seems fair to me. @PaulYoder, if you can't wait for the rewrite you could add your own extension method like so: public static class FluentNHExtensions { public static IProperty ColumnNames(this IProperty property, params string[] columnNames) { property.ColumnNames.Clear(); foreach(var name in columnNames) { property.ColumnNames.Add(name); } return property; } } I'm not really sure why adding more than one column to the collections in a method would affect the conventions though From: fluent-nhibernate@googlegroups.com [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory Sent: 30 March 2009 17:29 To: fluent-nhibernate@googlegroups.com Subject: [fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap I think the way to go for this is to follow Jon's suggestion of having a single parameter method that can be used for if there's only one column, and the (currently available) collection property for use when you need to have more than one column, or if you need to modify or interrogate the collection at convention time. Paul and myself have already touched on how we can clean up the APIs a bit so they're not being polluted (and complicated) by the presence of methods and properties that are only of use for the conventions, and things like this will be the subject of cleanup. Until we get to the point where we can clean it up, there are going to be some areas that are more complicated than may be necessary. You guys are just going to have to get along until that time. On Mon, Mar 30, 2009 at 4:26 PM, James Gregory <jagregory....@gmail.com> wrote: Again, we had this previously and it suffers from the problem of not being able to interrogate or modify the collection at convention time. On Mon, Mar 30, 2009 at 4:06 PM, Paul Yoder <paulyo...@gmail.com> wrote: What about using a params string array in the method parameter to support single and multiple column names? So instead of Map(x => x.BusinessName).ColumnNames(c => { c.AddColumn("FirmCol1"); c.AddColumn("FirmCol2"); } it could be Map(x => x.BusinessName).ColumnNames("FirmCol1", "FirmCol2"); Paul On Sat, Mar 28, 2009 at 6:00 PM, Paul Batum <paul.ba...@gmail.com> wrote: Hi Lars, It looks like its been changed to support multiple columns. For now, this should work: Map(x => x.BusinessName).ColumnNames.Add("FirmName") I'm not sure if I like this change. James, did you consider achieving this with two methods, one that takes a string and another that takes a lambda with which you can specify multiple columns? I'm thinking something like: Map(x => x.BusinessName).ColumnName("FirmName"); and Map(x => x.BusinessName).ColumnNames(c => { c.AddColumn("FirmCol1"); c.AddColumn("FirmCol2"); } Thoughts? On Sun, Mar 29, 2009 at 9:39 AM, Lars <larc...@yahoo.com> wrote: I see that TheColumnNameIs has been replaced with ColumnName in IIdentityPart, but I can't figure out what it was changed to in PropertyMap. The Map statement is: Map(x => x.BusinessName).TheColumnNameIs("FirmName"); But this no longer works. Thanks, Lars --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---