[fluent-nhib] ignoreproperty

2009-03-14 Thread Blee
I just recently started using Fluent NHibernate and have to say that it is a fantastic help. Recently we ran into a small issue that I can't seem to find an obvious way around. Obvious to me, I should say. :) We use this class as a base type so that the Id and a couple of other fields will be

[fluent-nhib] What about support auxiliary database objects?

2009-03-14 Thread Rub
What about support auxiliary database objects? This official nhibernate documentation: 5.6 http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/mapping.html I want to use some server's views in my application. I have the immutable classes mapping for this views, and I have create

[fluent-nhib] Re: What about support auxiliary database objects?

2009-03-14 Thread James Gregory
You can't currently. Either use hbm.xml or traditional sql. On Sat, Mar 14, 2009 at 3:30 PM, Rub ruboard@gmail.com wrote: What about support auxiliary database objects? This official nhibernate documentation: 5.6

[fluent-nhib] Possible problem with IPropertyConvention

2009-03-14 Thread JohnRudolfLewis
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 {

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread James Gregory
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

[fluent-nhib] Re: What about support auxiliary database objects?

2009-03-14 Thread Rub
How can I work with fluent nhibernate class maps and hbm (embedded resource files) together in FH? On 14 мар, 21:02, James Gregory jagregory@gmail.com wrote: You can't currently. Either use hbm.xml or traditional sql. On Sat, Mar 14, 2009 at 3:30 PM, Rub ruboard@gmail.com wrote:

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread JohnRudolfLewis
I figured out what caused it, but I am still stuck Some of my properties happens to be reserved words in the database. So in my ClassMap, I explicitely declare them like this: Map(x = x.Column) .ColumnName(COLUMN_NAME); I need to be able to explicitly call ColumnName in my ClassMaps

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread JohnRudolfLewis
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

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread JohnRudolfLewis
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)

[fluent-nhib] Filed AutoMapping

2009-03-14 Thread Mike Chaliy
In our development we are frequently using readonly properties backed with private fields. Is there any way to automap such case? From my walking through code this is impossible to create custom convention just because: public virtual void mapEverythingInClassT

[fluent-nhib] Re: What about support auxiliary database objects?

2009-03-14 Thread James Gregory
Read the wiki: http://wiki.fluentnhibernate.org/show/FluentConfiguration 2009/3/14 Rub ruboard@gmail.com How can I work with fluent nhibernate class maps and hbm (embedded resource files) together in FH? On 14 мар, 21:02, James Gregory jagregory@gmail.com wrote: You can't

[fluent-nhib] Re: Fields AutoMapping

2009-03-14 Thread James Gregory
You need to use Access.AsField() to inform FNH that the readonly property is backed by a field. On Sat, Mar 14, 2009 at 4:48 PM, Mike Chaliy m...@chaliy.name wrote: In our development we are frequently using readonly properties backed with private fields. Is there any way to automap such

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread JohnRudolfLewis
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

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread James Gregory
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.comwrote: Thanks. That tidbit will proove useful. But I still think that there should be a clean way of

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread JohnRudolfLewis
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.comwrote: Thanks.

[fluent-nhib] Re: Possible problem with IPropertyConvention

2009-03-14 Thread James Gregory
No problem :) On Sat, Mar 14, 2009 at 5:32 PM, JohnRudolfLewis johnrle...@gmail.comwrote: 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);

[fluent-nhib] Re: What about support auxiliary database objects?

2009-03-14 Thread Rub
How can I get NHibernate.Configuration object from Fluently object? I use my multi factory configuration provider and I don't want BuildSessionFactory(), simple, I just need NHibernate.Configuration. On 14 мар, 21:55, James Gregory jagregory@gmail.com wrote: Read the

[fluent-nhib] Re: ForTypesThatDeriveFrom and private fields

2009-03-14 Thread Nick Gieschen
Hey, Not sure what you mean by this. As far as I can tell, Reveal doesn't work on fields. I get the same error as Anders. I tried adding Access.AsField() for the heck of it as well and it still threw a FluentNHibernate.UnknownPropertyException. So, is this a bug? It seems to me Reveal should

[fluent-nhib] Re: ignoreproperty

2009-03-14 Thread Adam Dymitruk
What would you suggest? On Fri, Mar 13, 2009 at 10:44 PM, Blee le...@abl-consulting.com wrote: I just recently started using Fluent NHibernate and have to say that it is a fantastic help. Recently we ran into a small issue that I can't seem to find an obvious way around. Obvious to me, I

[fluent-nhib] Re: What about support auxiliary database objects?

2009-03-14 Thread James Gregory
You can either pass an existing instance into the Fluently.Configure method, or you can use BuildConfiguration. 2009/3/14 Rub ruboard@gmail.com How can I get NHibernate.Configuration object from Fluently object? I use my multi factory configuration provider and I don't want

[fluent-nhib] Re: ForTypesThatDeriveFrom and private fields

2009-03-14 Thread James Gregory
The key to what paul said is private auto properties. Use an autoproperty, not a field. private string PasswordHash { get; set; } instead of private string PasswordHash; On Sat, Mar 14, 2009 at 5:59 PM, Nick Gieschen nickgiesc...@gmail.comwrote: Hey, Not sure what you mean by this. As far

[fluent-nhib] Re: ignoreproperty

2009-03-14 Thread Blee
I was hoping that I was simply missing how to do this. Ideally, what I would like to be able to ignore a property off of a base class instead of having to ignore that property on each child class. Unfortunately, at the moment, I get an invalid cast trying to AutoMapBaseClass to AutoMapSubClass.

[fluent-nhib] Re: ignoreproperty

2009-03-14 Thread Jon Kruger
I haven't tried what I'm about to propose, but I think it would work. 1) Create an attribute that you will put on the properties that you want to ignore (for example, an [Ignore] attribute) 2) Override the IPropertyConvention (see here: http://wiki.fluentnhibernate.org/show/Conventions). In the

[fluent-nhib] Re: What about support auxiliary database objects?

2009-03-14 Thread James Gregory
Please re-read my previous email. you can use BuildConfiguration, that method will do what you ask. If you don't have that method, you need to get the latest source. 2009/3/14 Rub ruboard@gmail.com I don't want to pass my instance to Fluently. I want to get NHibernate.Configuration from

[fluent-nhib] Re: ignoreproperty

2009-03-14 Thread Blee
Using a property convention, I am able to apply a particular property convention to that property (rename tables, fields, etc) but I don't see a way to ignore it. If there is, this approach would be ideal. On Mar 14, 3:26 pm, Jon Kruger krugs...@gmail.com wrote: I haven't tried what I'm about

[fluent-nhib] Re: Fields AutoMapping

2009-03-14 Thread James Gregory
You should be able to do this with a convention: public class AccessAsFieldConvention : IPropertyConvention { public bool Accept(IProperty target) { return true; // or filter on target.EntityType for just specific entities } public void Apply(IProperty target) {

[fluent-nhib] Re: Fields AutoMapping

2009-03-14 Thread Mike Chaliy
This is will work only if you have property... I have an public Comment[] Comments {{get..}} And seems that Fluent-NHibernate does not treat this as property. Fortunately I can switch to IEnumerable, as far I know this will work. Thank you very much for your support! BTW what is you preferred

[fluent-nhib] Re: Fields AutoMapping

2009-03-14 Thread James Gregory
This is will work only if you have property... I have an public Comment[] Comments {{get..}} It's helpful to know that kind of thing before I spend time fixing things. I've just committed another set of changes that expose the Access property to the other conventions; so now you can

[fluent-nhib] Re: Fields AutoMapping

2009-03-14 Thread Mike Chaliy
Thank you very much, I will try new version tomorrow. On Mar 15, 1:08 am, James Gregory jagregory@gmail.com wrote: This is will work only if you have property... I have an public Comment[] Comments {{get..}} It's helpful to know that kind of thing before I spend time fixing things.

[fluent-nhib] Re: Mapping issue

2009-03-14 Thread James Gregory
Consider it fixed. There's now a NotFound property on HasMany and HasManyToMany. On Sat, Mar 14, 2009 at 6:57 PM, Adam Dymitruk adymit...@gmail.com wrote: Would a temporary work-around using views help? On Thu, Mar 12, 2009 at 8:19 AM, Andrew Burns erebus...@gmail.com wrote: I also asked

[fluent-nhib] Re: ignoreproperty

2009-03-14 Thread Jon Kruger
What's the purpose of the Accept() method then if it's not to ignore certain properties? On Sat, Mar 14, 2009 at 7:00 PM, James Gregory jagregory@gmail.comwrote: Although the idea is sound, it unfortunately won't work as there's no way to ignore properties through conventions. Definitely

[fluent-nhib] Re: ignoreproperty

2009-03-14 Thread James Gregory
Automapping is a different game entirely. The Accept method is used to ignore properties when applying conventions. The automapper has an explicit IgnoreProperty that's used to actually not map the property at all, which is completely different. On Sun, Mar 15, 2009 at 1:27 AM, Jon Kruger