No problem :) On Sat, Mar 14, 2009 at 5:32 PM, JohnRudolfLewis <johnrle...@gmail.com>wrote:
> > Duh... Thanks. > > On Mar 14, 10:17 am, James Gregory <jagregory....@gmail.com> wrote: > > What's wrong with this: > > public bool Accept(IProperty target) > > { > > return (target.ColumnNames.List().Count == 0); > > > > } > > > > On Sat, Mar 14, 2009 at 5:15 PM, JohnRudolfLewis <johnrle...@gmail.com > >wrote: > > > > > > > > > > > > > Thanks. That tidbit will proove useful. But.... I still think that > > > there should be a clean way of making the IPropertyConvention only > > > apply if I've not already explicitly specified a column name. > > > > > On Mar 14, 9:58 am, James Gregory <jagregory....@gmail.com> wrote: > > > > If your column names are sometimes reserved words, you can wrap them > in > > > > backticks. So you could remove the explicit column name from the Map > call > > > > and modify your convention to do: "`" + > > > > target.Property.Name.ToUpperCaseUnderscore() > > > > + "`" > > > > That will make NHibernate escape the column names in any queries. > > > > > > On Sat, Mar 14, 2009 at 4:42 PM, JohnRudolfLewis < > johnrle...@gmail.com > > > >wrote: > > > > > > > I got it working, but the code does not feel right. The code in my > > > > > Apply method is what really bugs me. > > > > > > > In my class map, I now need to do the following...... > > > > > > > Map(x => x.Column, "COLUMN_NAME") > > > > > > > And in my IPropertyConvention I need to do this.... > > > > > > > public void Apply(IProperty target) > > > > > { > > > > > if (target.ColumnNames.List().Count == 0) > > > > > { > > > > > target.ColumnNames.Add > > > > > (target.Property.Name.ToUpperCaseUnderscore()); > > > > > } > > > > > } > > > > > > > On Mar 14, 9:29 am, JohnRudolfLewis <johnrle...@gmail.com> wrote: > > > > > > I forget the number, but it was from yesterday. I will try to > rewrite > > > > > > considering what you just posted. (our posts crossed) > > > > > > > > On Mar 14, 9:16 am, James Gregory <jagregory....@gmail.com> > wrote: > > > > > > > > > How recently did you update? > > > > > > > Properties can have multiple columns and it was ambiguous > whether > > > you > > > > > were > > > > > > > setting the name or adding an extra one, I've since updated the > > > code to > > > > > make > > > > > > > it a bit clearer. If I remember correctly your Apply should > > > contain: > > > > > > > > > target.ColumnNames.Clear(); // make sure there are no other > columns > > > > > > > specified first > > > > > target.ColumnNames.Add(target.Property.Name.ToUpperCaseUnderscore()); > > > > > > > > > On Sat, Mar 14, 2009 at 4:07 PM, JohnRudolfLewis < > > > johnrle...@gmail.com > > > > > >wrote: > > > > > > > > > > I am playing with the latest conventions code and loving it > so > > > far. > > > > > > > > But when I tried to implement a convention for my column > names to > > > > > > > > match what my Oracle DBA tells me I must do, I run into > trouble. > > > > > > > > > > When I declare the following: > > > > > > > > > > public class ColumnNameConvention : IPropertyConvention > > > > > > > > { > > > > > > > > public bool Accept(IProperty target) > > > > > > > > { > > > > > > > > return true; > > > > > > > > } > > > > > > > > > > public void Apply(IProperty target) > > > > > > > > { > > > > > > > > // ToUpperCaseUnderscore is an extension I declare > > > > > > > > elsewhere, it returns a string > > > > > > > > target.ColumnName > > > > > > > > (target.Property.Name.ToUpperCaseUnderscore()); > > > > > > > > } > > > > > > > > } > > > > > > > > > > I get the following errors: > > > > > > > > > > FluentNHibernate.Cfg.FluentConfigurationException : An > > > invalid or > > > > > > > > incomplete configuration was used while creating a > > > SessionFactory. > > > > > > > > Check PotentialReasons collection, and InnerException for > more > > > > > detail. > > > > > > > > > > NHibernate.MappingException : property mapping has wrong > > > number > > > > > > > > of columns: MyMappingTest.DomainModel.User.PersonType type: > > > String- > > > > > Hide quoted text - > > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---