[fluent-nhib] Re: Collection returned as Array

2009-03-30 Thread Paul Batum
Excellent, thanks Jeremy, I will take a look at this tonight. On Tue, Mar 31, 2009 at 10:34 AM, Jeremy Wadsack wrote: > > I'm having the same problem. It doesn't generate the element > for the HBM. Here's some relevant code: > > > > MODEL: > > public class Module > { > public virtual Test[] Te

[fluent-nhib] Re: Collection returned as Array

2009-03-30 Thread Jeremy Wadsack
I'm having the same problem. It doesn't generate the element for the HBM. Here's some relevant code: MODEL: public class Module { public virtual Test[] Tests { get; set; } } MAPPING: HasManyToMany(x => x.Tests) .WithTableName("t_module_test") .WithParentKe

[fluent-nhib] Re: One to Many issues with the Example.FirstProject

2009-03-30 Thread James Gregory
Ah, forgot to update the wiki! It's now updated. On Mon, Mar 30, 2009 at 11:15 PM, depaulo wrote: > > AAAGH! Sorry! I since read DG's reply properly (I was copying your > code from the website tutorial which needs to be updated). Added the > Cascade.All() and it now works. Oops. > > On Mar 30, 11

[fluent-nhib] Re: One to Many issues with the Example.FirstProject

2009-03-30 Thread depaulo
AAAGH! Sorry! I since read DG's reply properly (I was copying your code from the website tutorial which needs to be updated). Added the Cascade.All() and it now works. Oops. On Mar 30, 11:03 pm, depaulo wrote: > I am afraid I have the same problem and am using the latest code from > the reposito

[fluent-nhib] Re: One to Many issues with the Example.FirstProject

2009-03-30 Thread depaulo
I am afraid I have the same problem and am using the latest code from the repository (revision 432). All the tables are saving apart from the Employee table (I am using SQL Server 2005) Any help appreciated! On Mar 25, 10:09 pm, James Gregory wrote: > Great, glad that fixed it. > And yes, that's

[fluent-nhib] joined subclass inheritance with optional subclasses

2009-03-30 Thread Jaggernoth
Hi I'm creating an application with possibility of adding plugins and I'd like to use fluent nhibernate for entity mappings. But I've got a problem with lack of simple way of creating subclasses without modifying a classmap of base class. Let's say I've got some core assembly with mapping of 'Simp

[fluent-nhib] Re: Many to One reference by more than 1 column

2009-03-30 Thread Hudson Akridge
You could go that route, but that's messy, and in my experience will only end in tears for you :) If it's a legacy database, and you can't change the schema (otherwise you'd obviously be normalizing it a bit better), then alternatively you can create a Formula mapping: Map(x => x.County).FormulaI

[fluent-nhib] Re: Many to One reference by more than 1 column

2009-03-30 Thread Dallas
Hudson, Thanks for your suggestions. I had considered this before, but in my case this won't work because we have a UserCounties table that determines which counties a User has access (it is used in a Many to Many relationship, so this table is not mapped to an object). This table actually has

[fluent-nhib] Re: Many to One reference by more than 1 column

2009-03-30 Thread Hudson Akridge
Technically, you can't. Not directly like that. This is a NHibernate Limitation, not a Fluent limitation. What you need to do to get around it, is to set up a CompositeID mapping in your CountyMap, this would replace your "CountyID". The method is .UseCompositeID() on the ClassMap for CountyMap,

[fluent-nhib] Many to One reference by more than 1 column

2009-03-30 Thread Dallas
Hey guys, I have an issue where our legacy database model isn't exactly normalized- we have a list of Projects that need a County associated with them. In the Counties database we have a CountyID for the Primary Key, but in the Projects database we do not-- I need to map the County and Location_

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread Martin Hornagold
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 see

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread James Gregory
*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 c

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread Martin Hornagold
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.

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

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

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread James Gregory
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 wrote: > What about using a params string array in the method parameter to support > single and multiple column

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread Paul Yoder
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");

[fluent-nhib] Same Table Inheritance Issue

2009-03-30 Thread nformosa
Hi All, I'm all new and fresh on C# but not on hibernate, but im somewhat lost when it comes to inheritance and the use of Fluent in this case. I have a Table called Property which has one or many PropertyFeatures. Now Property Features can either be a Service, Inclusion or a feature and these a

[fluent-nhib] Fluent NHibernate Configuration for Session Context

2009-03-30 Thread Action Jackson
I apologize in advance if this question has been answered many times over. How can I specify the session context using the Fluent configuration? In other words, what is the Fluent translation of a traditional xml mapping like "thread_static"? --~--~-~--~~~---~--~--

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread Paul Batum
You said it yourself, its not so fluent. This approach reduces the readability of the code. On Mon, Mar 30, 2009 at 9:52 PM, NiHique wrote: > > What about: Map(x => x.BusinessName, "FirmName"); > > It is shorter and works pretty well, also with Identity ok, not so > fluent but still pretty s

[fluent-nhib] Re: Replacement for TheColumnNameIs in PropertyMap

2009-03-30 Thread NiHique
What about: Map(x => x.BusinessName, "FirmName"); It is shorter and works pretty well, also with Identity ok, not so fluent but still pretty straightforward;) On Mar 29, 11:15 am, James Gregory wrote: > I'm ok with that... :) > > On 3/29/09, Jon Kruger wrote: > > > Right, but couldn't you