[fluent-nhib] Re: Use of PersistenceSpecification

2009-03-18 Thread Paul Batum
Good catch Brendan. I need to pay more attention. On Thu, Mar 19, 2009 at 2:34 PM, Brendan Erwin wrote: > He's not testing the actual object created in his example. He's testing the > Catalog entity which "HasMany" Business entities. > Here is an example from my project that works: >         [Te

[fluent-nhib] Collection returned as Array

2009-03-18 Thread Sean Feldman
Hi, I have tried to map a collection of child entities as an array. Can't figure out what is wrong, as there's no documentation on the subject. The FNH wiki (http://wiki.fluentnhibernate.org/show/ StandardMappingCollectionTypes) says it's just applying .AsArray(); but in reality it is not. Any ide

[fluent-nhib] Re: Use of PersistenceSpecification

2009-03-18 Thread Brendan Erwin
He's not testing the actual object created in his example. He's testing the Catalog entity which "HasMany" Business entities. Here is an example from my project that works: [Test] public void PayerMapping() { var states = new List { new State { Abbreviati

[fluent-nhib] Re: How to make IClassConvention or IIdConvention not override my ClassMap

2009-03-18 Thread Brendan Erwin
I have a similar problem. I'm working with a legacy database so my mappings have lots of column names specified. However, I'd like to use conventions for new entities but I find that specifying conventions overrides things specified in my mappings. So, +1 on a solution to this. On Mar 16,

[fluent-nhib] Re: Mapping Generic Types

2009-03-18 Thread James Gregory
What doesn't work about mapping explicit implementations? On Thu, Mar 19, 2009 at 12:48 AM, Joshua wrote: > > I'm talking about mapping the concrete implementation of a generic > class: > > public class GenericClass > { > } > > public class ConcreteClass : GenericClass > { > } > > ConcreteClass

[fluent-nhib] Re: Mapping Generic Types

2009-03-18 Thread Joshua
I'm talking about mapping the concrete implementation of a generic class: public class GenericClass { } public class ConcreteClass : GenericClass { } ConcreteClass can be mapped with Fluent, but an explicit implementation of GenericClass, like GenericClass, cannot. The last example can be done

[fluent-nhib] Re: Is there a way to tell AutoPersistence to not look at a property?

2009-03-18 Thread James Gregory
I'm not entirely sure what you're trying to do with that property, but automapping has a ForTypesThatDeriveFrom method that you can call IgnoreProperty inside, which is used to ignore specific properties. On Wed, Mar 18, 2009 at 8:09 PM, wgp...@gmail.com wrote: > > Thanks John. I've decided to

[fluent-nhib] Re: Mapping Generic Types

2009-03-18 Thread Paul Batum
Can you elaborate on what exactly you are looking for? An example class and the associated hbm xml would be most useful. On Thu, Mar 19, 2009 at 7:28 AM, Joshua wrote: > > Is future support for mapping generic types planned? > > > > --~--~-~--~~~---~--~~ You rece

[fluent-nhib] Re: Use of PersistenceSpecification

2009-03-18 Thread Paul Batum
That is not how it works. The PersistenceSpecification does not test against an object instance that you have created. Here is an example test from the the ConnectedTester: [Test] public void MappingTest1() { new PersistenceSpecification(_source)

[fluent-nhib] Re: SchemaUpdate and Fluent NH

2009-03-18 Thread Brendan Erwin
This isn't exactly what you are asking for, but since you say you are building a test program... http://brendanjerwin.github.com/2009/03/11/using-nhibernate-validator-with-fluent-nhibernate.html Scroll down towards the bottom in the "Bonus" section. You can see how I manage the schema in Sql

[fluent-nhib] Re: Mapping an array of bytes

2009-03-18 Thread Paul Batum
Map(x => x.YourByteArrayHere) .WithLengthOf(MAX_LENGTH_HERE); Should work fine if you don't care about the type of the sql column. On Wed, Mar 18, 2009 at 11:57 PM, Sean Feldman wrote: > > Hello, > I am trying to figure out how to map an array of bytes, and can't find > an example that would

[fluent-nhib] Re: WithTable "optional=true"

2009-03-18 Thread James Gregory
I think that's the only way currently, yes. On Wed, Mar 18, 2009 at 9:24 PM, brendanjerwin wrote: > > Am I missing the fluent way to get optional=true on the join element? > > Is m.SetAttribute("optional","true") the best current way? > > > --~--~-~--~~~---~--~~ Y

[fluent-nhib] WithTable "optional=true"

2009-03-18 Thread brendanjerwin
Am I missing the fluent way to get optional=true on the join element? Is m.SetAttribute("optional","true") the best current way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to t

[fluent-nhib] using WithTable() with lambda

2009-03-18 Thread Douglas
I think I've encountered a bug when 'ing two tables using WithTable() with lambda. Here's what I have. // Schema table PODetail ( PODetailID int identity(1,1) primary key PONumber varchar(15) foreign key (POHeader) references (PONumber) UnitOfIssue varchar(2) foreign key (UnitOfIssue) refer

[fluent-nhib] Mapping Generic Types

2009-03-18 Thread Joshua
Is future support for mapping generic types planned? --~--~-~--~~~---~--~~ 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 f

[fluent-nhib] Re: Is there a way to tell AutoPersistence to not look at a property?

2009-03-18 Thread wgp...@gmail.com
Thanks John. I've decided to go back to writing the class mappings myself until the automapping feature matures a bit. Decorating my domain model with attributes for use only with the AutoPersistence feature of FNH is in my opinion a violation of concerns. On Mar 18, 10:26 am, Jon Kruger wrote

[fluent-nhib] fluent mappings and filtering types.

2009-03-18 Thread Luis Abreu
Hello guys. I'm converting some old code I had which used mapping visitors to load and populate the Configurationn object. I was under the impression that this code: var configuration = Fluently.Configure( ) .Database( GetDatabaseInfo() ) .Mappi

[fluent-nhib] Re: Is there a way to tell AutoPersistence to not look at a property?

2009-03-18 Thread Jon Kruger
You have to put the attribute on the properties that you don't want to map (if you're using the auto-mapper). The other alternative is to use the fluent mappings for your class instead (that is, you write the mappings instead of having the auto-mapper do it for you). On Wed, Mar 18, 2009 at 1:22

[fluent-nhib] Re: Is there a way to tell AutoPersistence to not look at a property?

2009-03-18 Thread wgp...@gmail.com
Thanks. Does the last method in that thread simply not map unmappable properties/methods ... or do I have to specify all the properties/ methods in each of my classes that I don't want mapped (seems like a pain). On Mar 18, 10:15 am, Jon Kruger wrote: > This thread shows a couple different ways

[fluent-nhib] Re: Is there a way to tell AutoPersistence to not look at a property?

2009-03-18 Thread Jon Kruger
This thread shows a couple different ways you can ignore properties (unfortunately it's not baked into FNH): http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/3c338137374971ce On Wed, Mar 18, 2009 at 1:12 PM, wgp...@gmail.com wrote: > > Example: > > I have a helper property

[fluent-nhib] Is there a way to tell AutoPersistence to not look at a property?

2009-03-18 Thread wgp...@gmail.com
Example: I have a helper property defined as such, that for a particular Division object, will return a collection of all its ancestors based on a parent/child relationship in the db: List ancestors; public virtual IList Ancestors { get { ancestors = ancestors ??

[fluent-nhib] Re: ExportTo a new folder?

2009-03-18 Thread Jon Kruger
I ran into the same problem yesterday, it definitely does not create the new folder. I would submit the patch. On Wed, Mar 18, 2009 at 11:04 AM, MaggiePlusPlus wrote: > > I am using the ExportTo method to obtain a copy of the xml mapping > files for testing. > > Currently if you provide a folder

[fluent-nhib] ExportTo a new folder?

2009-03-18 Thread MaggiePlusPlus
I am using the ExportTo method to obtain a copy of the xml mapping files for testing. Currently if you provide a folder name that does not exist you get an exception. Is this the expected behavior? I am used to tools creating a folder if it does not exist, but I realize I do not know what the be

[fluent-nhib] Re: Registering Interceptor via NH

2009-03-18 Thread Jon Kruger
In that case, do something like this to create your sessions: _sessionFactory.OpenSession(interceptor); On Wed, Mar 18, 2009 at 10:56 AM, epitka wrote: > > I know about the events, but I could not find anything there about > IsTransient flag which lets me control myself whether the entity is > t

[fluent-nhib] Re: Registering Interceptor via NH

2009-03-18 Thread epitka
I know about the events, but I could not find anything there about IsTransient flag which lets me control myself whether the entity is transient or not. (legacy db, composite keys). This used to be IsUnsaved and is still in docs as IsUnsaved. But I thought that expose configuration should allow

[fluent-nhib] Re: Registering Interceptor via NH

2009-03-18 Thread Jon Kruger
I don't know that FNH has support for interceptors, but in NHibernate 2.0 they added events, which are way nicer than using the interceptor. The event model allows you to hook into a lot more than the interceptor and it doesn't feel as hacky as the interceptor did. Here's an example of one event (

[fluent-nhib] Registering Interceptor via NH

2009-03-18 Thread epitka
Should this work? _sessionFactory = Fluently.Configure(Configuration) .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.Load("SR.Domain"))) .Mappings(m => m.HbmMappings.AddFromAssembly(Assembly.Load("SR.Domain")))

[fluent-nhib] Use of PersistenceSpecification

2009-03-18 Thread aragorn185
Hello, i would like to use PersistenceSpecification in order to test my mapping. My mapping is: public CatalogMap() { Id(x => x.Id, "id"); Map(x => x.Name, "name"); HasMany(x => x.Businesses) .Inverse() .KeyColumnNames.

[fluent-nhib] Re: Automapping and enums

2009-03-18 Thread gre...@slavec.net
Forgot to check if property is ReadOnly this code would be more appropriate: if (property.CanWrite) { if (property.PropertyType.IsEnum) return true; return property.PropertyType.Namespace == "System"; } On 18 mar., 14:42, "gre...@slavec.net" wrote: > The problem is

[fluent-nhib] Re: Automapping and enums

2009-03-18 Thread gre...@slavec.net
The problem is in method MapsProperty of class AutomMapColumn This line: if (property.CanWrite) return property.PropertyType.Namespace == "System"; will return false for enums and they will therefore be skipped. I think a check if a type is an enum should be added before this line, like t

[fluent-nhib] Re: Automapping and enums

2009-03-18 Thread trull...@googlemail.com
Looks like this answers my post a moment ago http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/349a341625971306 Andrew On Mar 18, 12:43 pm, "gre...@slavec.net" wrote: > Enums members in entities are skipped when automaping is used. > > I found this test in AutoMap tests: >

[fluent-nhib] Mapping an array of bytes

2009-03-18 Thread Sean Feldman
Hello, I am trying to figure out how to map an array of bytes, and can't find an example that would clearly show that. Do I need to map it as a custom type? Thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "F

[fluent-nhib] Automapping and enums

2009-03-18 Thread gre...@slavec.net
Enums members in entities are skipped when automaping is used. I found this test in AutoMap tests: [Test] public void ShouldAutoMapEnums() { Model(model => model .ForTypesThatDeriveFrom(mapping => mapping.Map(x => x.Enum).SetAttrib

[fluent-nhib] Re: Latest FNH code isnt auto mapping my Enum types

2009-03-18 Thread trull...@googlemail.com
OK adding this make everything work as I want, but enums still aren't mapped by default. Seems to be because enums dont end up as IProperty (as per EnumerationPropertyConvention) but are in fact an IUserType Andrew public class EnumMappingConvention : IUserTypeConvention {

[fluent-nhib] Latest FNH code isnt auto mapping my Enum types

2009-03-18 Thread trull...@googlemail.com
In a recent previous version of FNH i hacked FNH/Mapping/ EnumerationTypeConvention, replacling this line: Type mapperType = typeof(GenericEnumMapper<>).MakeGenericType (propertyMapping.PropertyType); with this: Type mapperType = propertyMapping.PropertyType; to make my enums be saved as Ints

[fluent-nhib] Re: LazyLoad false

2009-03-18 Thread James Gregory
You should read up on HQL and the Criteria API, you can specify on a per-query basis a lot of things. http://www.nhforge.org/doc/nh/en/index.html As for in the mappings, there is LazyLoad() and Not.LazyLoad() On Wed, Mar 18, 2009 at 9:27 AM, Tom Warnat wrote: > > I use a single seassion (open an

[fluent-nhib] Re: LazyLoad false

2009-03-18 Thread Tom Warnat
I use a single seassion (open and close) for getting a product within a program that references my mappings. I theres no way to set for that single session lazyload = false i will do it in the mapping. The SetAttribute("lazy", "false") was part of my mappings though. But it does not work. On 18

[fluent-nhib] Re: LazyLoad false

2009-03-18 Thread James Gregory
What do you mean for a single session? As far as mappings are concerned, you either set it or you don't. On Wed, Mar 18, 2009 at 8:55 AM, Tom Warnat wrote: > Hi, > > > > is there a way to set for a single session LazyLoad = false? > > > > I tried to set it with SetAttribute(“lazy”, “false”) for

[fluent-nhib] LazyLoad false

2009-03-18 Thread Tom Warnat
Hi, is there a way to set for a single session LazyLoad = false? I tried to set it with SetAttribute("lazy", "false") for all my session, but it does not seem to work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

[fluent-nhib] Re: ForTypesThatDeriveFrom and private fields

2009-03-18 Thread James Gregory
Yes, as Paul said, there's nothing stopping you using a property that access a private field; that's all handled through the standard NHibernate access-strategy stuff. What we don't have support for is just standalone fields, with no property access at all. This is because of proliferation of Prope