[fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate Integration Facility

2009-01-09 Thread Stefan Lieser

> Reason? No one has grabbed the 2.0.1 binaries and put them in yet :)

I see... well we did it ;-)

> I'll see if I can get this in this weekend if possible, but no guarantees.

No problem.

Cheers
Stefan Lieser
--
http://clean-code-developer.de

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate Integration Facility

2009-01-09 Thread Chad Myers
Reason? No one has grabbed the 2.0.1 binaries and put them in yet :)
 
I'll see if I can get this in this weekend if possible, but no guarantees.
 
-c



From: fluent-nhibernate@googlegroups.com on behalf of Stefan Lieser
Sent: Fri 1/9/2009 3:35 AM
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate 
Integration Facility




Hi Chad,

any reason for using 2.0 instead of 2.0.1?

Cheers,
Stefan Lieser
--
http://nhplugin.lieser-online.de  

Chad Myers schrieb:
> FYI, there's a Rake target for switching the binaries.  From the trunk/ 
> folder, type "rake -T".
> 
> These tasks are of particular interest:
> 
> rake nhib21   # Builds Fluent NHibernate against the NHibernate 2.1 
> lib...
> rake use_nhib_20  # Switches NHibernate dependencies to NHibernate 2.0
> rake use_nhib_21  # Switches NHibernate dependencies to NHibernate 2.1
>
> 
>
> From: fluent-nhibernate@googlegroups.com on behalf of Chris Bilson
> Sent: Thu 1/8/2009 1:44 PM
> To: Fluent NHibernate
> Subject: [fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate 
> Integration Facility
>
>
>
>
> The 2.1 NH binaries are in the FNH tree. I've just been copying those
> into the parent directory (where the c# projects get their references)
> and rebuilding building FNH.
>
> I ended up ditching the castle NH facility, after using it for many
> years. I realized what it does is really pretty simple, so I just
> built my own Unit of work implementation that handles session
> management, per request sessions and transactions in web apps, and of
> course integrating with FNH for configuring session factories.
>
> If anyone else is doing this it would be interesting to exchange
> ideas.
>
> On Jan 8, 10:42 am, "Sebastien Lambla"  wrote:
>> No luck with the trunk of castle though as it relies on 2.1 and fluent
>> nhibernate so far seems compiled against 2.0.
>>
>> Is there a way to change that when compiling fluent nhibernate? Or is there
>> a 2.0 compat nhibernate facility in castle?
>>
>> I've had to revert to using a SessionManager and manage my sessions myself.
>> Not nice!
>>
>> -Original Message-
>> From: fluent-nhibernate@googlegroups.com
>>
>> [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Mike Hadlow
>> Sent: 08 January 2009 17:02
>> To: Fluent NHibernate
>> Subject: [fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate
>> Integration Facility
>>
>> Woops, sorry that code above won't work. You have to create you own
>> IConfigurationBuilder. This one is tested and works:
>>
>> /// 
>> /// Default imlementation of 
>> /// 
>> public class FluentNHibernateConfigurationBuilder :
>> IConfigurationBuilder
>> {
>> /// 
>> /// Builds the Configuration object from the specifed configuration
>> /// 
>> /// 
>> /// 
>> public Configuration GetConfiguration(IConfiguration config)
>> {
>> Configuration cfg = new Configuration();
>>
>> ApplyConfigurationSettings(cfg,
>> config.Children["settings"]);
>>
>> cfg.AddMappingsFromAssembly(typeof(Order).Assembly);
>>
>> AdditionalConfiguration(config, cfg);
>>
>> return cfg;
>> }
>>
>> /// 
>> /// Override this method to provide additional configuration
>> /// 
>> /// 
>> /// 
>> public virtual void AdditionalConfiguration(IConfiguration config,
>> Configuration cfg) {}
>>
>> /// 
>> /// Applies the configuration settings.
>> /// 
>> /// The CFG.
>> /// The facility config.
>> protected void ApplyConfigurationSettings(Configuration cfg,
>> IConfiguration facilityConfig)
>> {
>> if (facilityConfig == null) return;
>>
>> foreach (IConfiguration item in facilityConfig.Children)
>> {
>> String key = item.Attributes["key"];
>> String value = item.Value;
>>
>> cfg.SetProperty(key, value);
>> }
>> }
>> }
>
>
>
>
> >
>
>
> 
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com  
> Version: 8.0.176 / Virus Database: 270.10.5/1882 - Release Date: 08.01.2009 
> 08:13
>





--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

<>

[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread James Gregory
I will still look into this behavior, as it is at the very least misleading.

On Fri, Jan 9, 2009 at 7:10 PM, Luis Abreu  wrote:

>  Hello guys,
>
>
>
> Yeah, it looks like now that is the solution for this problem. Using
> entityBase results in the creation of mappings for entitybase (which results
> in an exception because I'm only defining the class with a version element
> and that triggers an exception).
>
>
>
> Regarding the configuration, I was a  little bit puzzled because I tried
> adding the ForTypesThatDeriveFrom line I've shown in the
> previous mail and with that line I was getting the XML for the EntidadeBase
> class but not for the Disciplina class and that was something I wasn't
> expecting.
>
>
>
> Thanks again for your help!
>
>
>
> ---
>
> Luis Abreu
>
>
>
> *From:* fluent-nhibernate@googlegroups.com [mailto:
> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
> *Sent:* sexta-feira, 9 de Janeiro de 2009 12:14
>
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: question on auto mapping
>
>
>
> Andrew am I correct in thinking this...
>
>
>
> modeloPersistencia.ForTypesThatDeriveFrom<*EntidadeBase*>(eb =>
>   eb.Version(d => d.Versao)
> .TheColumnNameIs("Versao")
> .SetAttributes(new Attributes {
>   {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
>   {"unsaved-value", "null"},
>   {"generated", "always"}}));
>
>
>
> Should be replaced by one for each entity that has the version column?
>
>
>
> modeloPersistencia.ForTypesThatDeriveFrom<*Entity1*>(eb =>
>   eb.Version(d => d.Versao)
> .TheColumnNameIs("Versao")
> .SetAttributes(new Attributes {
>   {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
>   {"unsaved-value", "null"},
>   {"generated", "always"}}));
>
>
>
> modeloPersistencia.ForTypesThatDeriveFrom<*Entity2*>(eb =>
>   eb.Version(d => d.Versao)
> .TheColumnNameIs("Versao")
> .SetAttributes(new Attributes {
>   {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
>   {"unsaved-value", "null"},
>   {"generated", "always"}}));
>
> If I'm correct in that assumption... Luis, you could probably wrap this up
> in a little helper method for the time being. Something along the lines of:
>
>
>
> public void ConfigureVersion<*TEntity*>(PersistenceModel model)
>
> {
>
>   model.ForTypesThatDeriveFrom<*TEntity*>(eb =>
>
> eb.Version(d => d.Versao)
>   .TheColumnNameIs("Versao")
>   .SetAttributes(new Attributes {
> {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
> {"unsaved-value", "null"},
> {"generated", "always"}}));
>
> }
>
>
>
> Then in your auto mapping do this:
>
>
>
> // ... normal auto mapping stuff ...
>
> ConfigureVersion<*Entity1*>(modeloPersistencia);
>
> ConfigureVersion<*Entity2*>(modeloPersistencia);
>
>
>
> On Fri, Jan 9, 2009 at 12:04 PM, Andrew Stewart <
> andrew.stew...@i-nnovate.net> wrote:
>
> Hi james
>
>
>
> Thanks for looking at this for me. Yeah that makes sense as to why it's
> producing no xml. Luis are your problems solved now? Unfortunalty there is
> no automatic way to map your version column at this time, you'll have to
> take your manual mapping and apply it in the FromDerivedFromClass for each
> class in your solution.
>
>
> I think that should sort your issue out.
>
>
>
> Andy
>
>
>
> On Fri, Jan 9, 2009 at 11:48 AM, James Gregory 
> wrote:
>
> It's because with the AutoMapping, no mappings are actually generated until
> Configure is called.
>
>
>
> As for your other issue, I haven't forgotten about it I'm just not near a
> machine I can debug from. Hopefully tonight or sometime over the weekend
> I'll get a chance.
>
>
>
> On Fri, Jan 9, 2009 at 11:45 AM, Luis Abreu  wrote:
>
> Ok, that makes sense.
>
>
>
> Thanks,.
>
>
>
> ---
>
> Luis Abreu
>
>
>
> *From:* fluent-nhibernate@googlegroups.com [mailto:
> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
> *Sent:* sexta-feira, 9 de Janeiro de 2009 09:39
>
>
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: question on auto mapping
>
>
>
> You're missing a call to Configure. Before calling
> modeloPersistencia.WriteMappingsTo(@"d:\"); call
> modeloPersistencia.Configure(nhibernateConfig);
>
>
>
> On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:
>
> Btw James, one more question:
>
>
>
> When using the auto persistence, shouldn't  I be able to save the xml to
> disk by using the previous code? It's that I get nothing and stopping the
> debugger there I see 0 mappings on the persistencemodel
>
>
>
> Thanks.
>
>
>
>
>
> ---
>
> Luis Abreu
>
>
>
> *From:* fluent-nhibernate@googlegroups.com [mailto:
> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
> *Sent:* quinta-feira, 8 de Janeiro de 2009 16:27
>
>
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: question on auto mapping
>
>
>
> Hello Luis,
>
>
>
> I'm away from a machine with Visual Studio on right now, so I don't know
> how muc

[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread Luis Abreu
Hello guys,

 

Yeah, it looks like now that is the solution for this problem. Using
entityBase results in the creation of mappings for entitybase (which results
in an exception because I'm only defining the class with a version element
and that triggers an exception).

 

Regarding the configuration, I was a  little bit puzzled because I tried
adding the ForTypesThatDeriveFrom line I've shown in the
previous mail and with that line I was getting the XML for the EntidadeBase
class but not for the Disciplina class and that was something I wasn't
expecting.

 

Thanks again for your help!

 

---

Luis Abreu

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: sexta-feira, 9 de Janeiro de 2009 12:14
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: question on auto mapping

 

Andrew am I correct in thinking this...

 

modeloPersistencia.ForTypesThatDeriveFrom(eb =>
  eb.Version(d => d.Versao)
.TheColumnNameIs("Versao")
.SetAttributes(new Attributes {
  {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
  {"unsaved-value", "null"},
  {"generated", "always"}}));

 

Should be replaced by one for each entity that has the version column?

 

modeloPersistencia.ForTypesThatDeriveFrom(eb =>
  eb.Version(d => d.Versao)
.TheColumnNameIs("Versao")
.SetAttributes(new Attributes {
  {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
  {"unsaved-value", "null"},
  {"generated", "always"}}));

 

modeloPersistencia.ForTypesThatDeriveFrom(eb =>
  eb.Version(d => d.Versao)
.TheColumnNameIs("Versao")
.SetAttributes(new Attributes {
  {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
  {"unsaved-value", "null"},
  {"generated", "always"}}));

If I'm correct in that assumption... Luis, you could probably wrap this up
in a little helper method for the time being. Something along the lines of:

 

public void ConfigureVersion(PersistenceModel model)

{

  model.ForTypesThatDeriveFrom(eb =>

eb.Version(d => d.Versao)
  .TheColumnNameIs("Versao")
  .SetAttributes(new Attributes {
{"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
{"unsaved-value", "null"},
{"generated", "always"}}));

}

 

Then in your auto mapping do this:

 

// ... normal auto mapping stuff ...

ConfigureVersion(modeloPersistencia);

ConfigureVersion(modeloPersistencia);

 

On Fri, Jan 9, 2009 at 12:04 PM, Andrew Stewart
 wrote:

Hi james

 

Thanks for looking at this for me. Yeah that makes sense as to why it's
producing no xml. Luis are your problems solved now? Unfortunalty there is
no automatic way to map your version column at this time, you'll have to
take your manual mapping and apply it in the FromDerivedFromClass for each
class in your solution. 


I think that should sort your issue out.

 

Andy

 

On Fri, Jan 9, 2009 at 11:48 AM, James Gregory 
wrote:

It's because with the AutoMapping, no mappings are actually generated until
Configure is called.

 

As for your other issue, I haven't forgotten about it I'm just not near a
machine I can debug from. Hopefully tonight or sometime over the weekend
I'll get a chance.

 

On Fri, Jan 9, 2009 at 11:45 AM, Luis Abreu  wrote:

Ok, that makes sense.

 

Thanks,.

 

---

Luis Abreu

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: sexta-feira, 9 de Janeiro de 2009 09:39


To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: question on auto mapping

 

You're missing a call to Configure. Before calling
modeloPersistencia.WriteMappingsTo(@"d:\"); call
modeloPersistencia.Configure(nhibernateConfig);

 

On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:

Btw James, one more question:

 

When using the auto persistence, shouldn't  I be able to save the xml to
disk by using the previous code? It's that I get nothing and stopping the
debugger there I see 0 mappings on the persistencemodel

 

Thanks.

 

 

---

Luis Abreu

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: quinta-feira, 8 de Janeiro de 2009 16:27


To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: question on auto mapping

 

Hello Luis,

 

I'm away from a machine with Visual Studio on right now, so I don't know how
much help I can be, but lets try to work through your problem.

 

Firstly, why is it that you're using a IUserType for your version? What is
the type that your version property has in your entity? I ask that because
Fluent NHibernate has a few options for mapping Versions and Timestamps.

*   If you call your property Timestamp and give it a type of TimeSpan,
Fluent NHibernate will automatically map that to a Timestamp.
*   If you call your property Version, and give it a type of int or
long, then it will map it as a Version.

Are any of those possible 

[fluent-nhib] Re: Automap Inheritance Issue

2009-01-09 Thread James Gregory
That's quite an interesting usage pattern I hadn't thought of Bart. Very
nice.

On Fri, Jan 9, 2009 at 2:06 PM,  wrote:

>
> Troy,
>
> I think it's very usefull to combine the automapping with custom
> mapping to get the best of both worlds. The approach that I'm testing
> out is defining your custom mapping as a specialization of an
> automap:
>
> eg.
> My entity customer:
> public class Customer
>{
>public Guid Id {get;set;}
>public string PartyNumber { get; set; }
>public string FirstName { get; set; }
>public string LastName { get; set; }
>}
>
> My customized Customer AutoMap (which I put in my repository
> assembly):
> public class CustomerMap : AutoMap
>{
>public CustomerMap()
>{
>Map(c => c.PartyNumber).TheColumnNameIs("party");
>}
>}
> (AutoMap inherits from ClassMap)
>
> Load the 'customized AutoMap's first using
> model.MergeWithAutoMapsFromAssemblyOf(); //model is
> AutoPersistenceModel
>
> Maybe this can be of interest to you.
>
> Bart.
>
> On 8 jan, 10:03, "Andrew Stewart" 
> wrote:
> > Hi Troy
> > Yeah, to get the benefit you really have to set a bunch of constraints
> and
> > try to stay inside them it's usually best on a greenfield to be honest.
> >
> > Andy
> >
> >
> >
> >
> >
> > On Thu, Jan 8, 2009 at 4:29 AM, Troy Goode  wrote:
> > > Thanks Andy,
> >
> > > Evidently I had a version of the source from before IsBaseType was
> > > introduced. Once I refreshed and rebuilt the source I was able to get
> > > everything working. In the end, though, I decided to go back to using
> > > ClassMap because I was having to create so many overrides for things
> like
> > > WithLengthOf(x) and CanNotBeNull() that it wasn't worth it for my
> particular
> > > project. It was a fun spike though!
> >
> > > Troy
> >
> > > On Tue, Jan 6, 2009 at 2:39 PM, Andrew Stewart <
> > > andrew.stew...@i-nnovate.net> wrote:
> >
> > >> Hi Troy
> > >> Here we go straight from the tests :o), always a good place to put
> things
> > >> you can't remember.
> >
> > >>  var autoMapper = AutoPersistenceModel
> > >> .MapEntitiesFromAssemblyOf()
> > >> .Where(t => t.Namespace ==
> > >> "FluentNHibernate.AutoMap.TestFixtures.SuperTypes")
> > >> .WithConvention(c =>
> > >> {
> > >> c.IsBaseType = b => b ==
> > >> typeof(BaseEntity);
> > >> });
> >
> > >> That should do it for you.
> >
> > >> Andy
> >
> > >> On Tue, Jan 6, 2009 at 4:57 PM, Troy Goode 
> wrote:
> >
> > >>> Thanks Andrew, that makes sense, but unfortunately I'm still not
> > >>> getting it to work. I added a convention for GetPrimaryKeyName, but
> > >>> wasn't able to determine what convention to use to change the
> > >>> baseobject to BaseEntity from object. When you have some time, any
> > >>> help would be appreciated.
> >
> > >>> Troy
> >
> > >>> On Jan 6, 11:44 am, "Andrew Stewart" 
> > >>> wrote:
> > >>> > Hi Troy
> > >>> > I'm away from the code right now but the answers your are looking
> for
> > >>> are
> > >>> > under the WithConventions method.
> >
> > >>> > From there you can set your baseobject to be BaseEntity rather than
> > >>> object
> > >>> > and set GetPrimaryKeyName to be Id.
> >
> > >>> > Hope that helps if not i'll look it up when I'm back at a machine.
> >
> > >>> > Andy
> >
> > >>> > On Tue, Jan 6, 2009 at 4:35 PM, Troy Goode 
> > >>> wrote:
> >
> > >>> > > Alright, I'm stumped. I have everything working fine with normal
> FNH,
> > >>> > > but once I tried to spike automapping I ran into an issue. In my
> > >>> > > project I have a base class for all of my entities like so:
> >
> > >>> > > public abstract class BaseEntity
> > >>> > > {
> > >>> > >public virtual int? Id { get; set; }
> > >>> > >public virtual DateTime? DateCreated { get; set; }
> > >>> > >public virtual DateTime? DateLastModified { get; set; }
> > >>> > >public virtual DateTime? DateDeleted { get; set; }
> > >>> > > }
> >
> > >>> > > So an example of one of my entities would be:
> >
> > >>> > > public class Foo : BaseEntity
> > >>> > > {
> > >>> > >public virtual string Name { get; set; }
> > >>> > > }
> >
> > >>> > > Finally, my autopersit setup looks like so:
> >
> > >>> > > var persistanceModel = AutoPersistenceModel
> > >>> > >.MapEntitiesFromAssemblyOf()
> > >>> > >.Where( t=> t.Namespace == "MyNamespace" && t.Name !=
> > >>> > > "BaseEntity" )
> > >>> > >.ForTypesThatDeriveFrom( t=>
> > >>> > > {
> > >>> > >t.Id( e => e.Id,
> "Id"
> > >>> );
> > >>> > >t.Map( e=>
> > >>> e.DateCreated );
> > >>> > >t.Map( e=>
> > >>> > > e.DateLastModified );
> > >>> > >  

[fluent-nhib] Re: Automap Inheritance Issue

2009-01-09 Thread bti . timmermans

Troy,

I think it's very usefull to combine the automapping with custom
mapping to get the best of both worlds. The approach that I'm testing
out is defining your custom mapping as a specialization of an
automap:

eg.
My entity customer:
public class Customer
{
public Guid Id {get;set;}
public string PartyNumber { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}

My customized Customer AutoMap (which I put in my repository
assembly):
public class CustomerMap : AutoMap
{
public CustomerMap()
{
Map(c => c.PartyNumber).TheColumnNameIs("party");
}
}
(AutoMap inherits from ClassMap)

Load the 'customized AutoMap's first using
model.MergeWithAutoMapsFromAssemblyOf(); //model is
AutoPersistenceModel

Maybe this can be of interest to you.

Bart.

On 8 jan, 10:03, "Andrew Stewart" 
wrote:
> Hi Troy
> Yeah, to get the benefit you really have to set a bunch of constraints and
> try to stay inside them it's usually best on a greenfield to be honest.
>
> Andy
>
>
>
>
>
> On Thu, Jan 8, 2009 at 4:29 AM, Troy Goode  wrote:
> > Thanks Andy,
>
> > Evidently I had a version of the source from before IsBaseType was
> > introduced. Once I refreshed and rebuilt the source I was able to get
> > everything working. In the end, though, I decided to go back to using
> > ClassMap because I was having to create so many overrides for things like
> > WithLengthOf(x) and CanNotBeNull() that it wasn't worth it for my particular
> > project. It was a fun spike though!
>
> > Troy
>
> > On Tue, Jan 6, 2009 at 2:39 PM, Andrew Stewart <
> > andrew.stew...@i-nnovate.net> wrote:
>
> >> Hi Troy
> >> Here we go straight from the tests :o), always a good place to put things
> >> you can't remember.
>
> >>          var autoMapper = AutoPersistenceModel
> >>                     .MapEntitiesFromAssemblyOf()
> >>                     .Where(t => t.Namespace ==
> >> "FluentNHibernate.AutoMap.TestFixtures.SuperTypes")
> >>                     .WithConvention(c =>
> >>                                         {
> >>                                             c.IsBaseType = b => b ==
> >> typeof(BaseEntity);
> >>                                         });
>
> >> That should do it for you.
>
> >> Andy
>
> >> On Tue, Jan 6, 2009 at 4:57 PM, Troy Goode  wrote:
>
> >>> Thanks Andrew, that makes sense, but unfortunately I'm still not
> >>> getting it to work. I added a convention for GetPrimaryKeyName, but
> >>> wasn't able to determine what convention to use to change the
> >>> baseobject to BaseEntity from object. When you have some time, any
> >>> help would be appreciated.
>
> >>> Troy
>
> >>> On Jan 6, 11:44 am, "Andrew Stewart" 
> >>> wrote:
> >>> > Hi Troy
> >>> > I'm away from the code right now but the answers your are looking for
> >>> are
> >>> > under the WithConventions method.
>
> >>> > From there you can set your baseobject to be BaseEntity rather than
> >>> object
> >>> > and set GetPrimaryKeyName to be Id.
>
> >>> > Hope that helps if not i'll look it up when I'm back at a machine.
>
> >>> > Andy
>
> >>> > On Tue, Jan 6, 2009 at 4:35 PM, Troy Goode 
> >>> wrote:
>
> >>> > > Alright, I'm stumped. I have everything working fine with normal FNH,
> >>> > > but once I tried to spike automapping I ran into an issue. In my
> >>> > > project I have a base class for all of my entities like so:
>
> >>> > > public abstract class BaseEntity
> >>> > > {
> >>> > >        public virtual int? Id { get; set; }
> >>> > >        public virtual DateTime? DateCreated { get; set; }
> >>> > >        public virtual DateTime? DateLastModified { get; set; }
> >>> > >        public virtual DateTime? DateDeleted { get; set; }
> >>> > > }
>
> >>> > > So an example of one of my entities would be:
>
> >>> > > public class Foo : BaseEntity
> >>> > > {
> >>> > >        public virtual string Name { get; set; }
> >>> > > }
>
> >>> > > Finally, my autopersit setup looks like so:
>
> >>> > > var persistanceModel = AutoPersistenceModel
> >>> > >    .MapEntitiesFromAssemblyOf()
> >>> > >    .Where( t=> t.Namespace == "MyNamespace" && t.Name !=
> >>> > > "BaseEntity" )
> >>> > >    .ForTypesThatDeriveFrom( t=>
> >>> > >                                         {
> >>> > >                                                t.Id( e => e.Id, "Id"
> >>> );
> >>> > >                                                t.Map( e=>
> >>> e.DateCreated );
> >>> > >                                                t.Map( e=>
> >>> > > e.DateLastModified );
> >>> > >                                                t.Map( e=>
> >>> e.DateDeleted );
> >>> > >                                         } );
>
> >>> > > The problem I've encountered is that when NH goes to generate its
> >>> > > query, it comes up with something like so:
>
> >>> > > SELECT
> >>> > >        this_.BaseEntityId as Id0_0_,
> >>> > >        this_1_.DateLastModified as DateLast2_0_0_,
> >>> > >        this_1_.Dat

[fluent-nhib] Re: PersistentModel -> Make Mappings Property

2009-01-09 Thread Paul Batum
Basically its a long way away because I am lazy :/

If you want to see one possibility, you could have a look at the pb-rewrite
branch.

As for the visitor case, you should have been able to utilize your own
IMappingVisitor without having to change any fluent nhibernate code. You
make your own custom persistence model and override the configure method to
use your custom visitor. There might be an even easier way, but I was fairly
sure that this one would at least work.

Paul Batum

On Sat, Jan 10, 2009 at 12:22 AM, James Gregory wrote:

> There are motions in place for moving away from explicit XML generation in
> the mapping, so maybe one day you'll be able to do everything you want to.
> However, it isn't our primary concern currently, and as long as there are
> major unimplemented NHibernate features, it won't be.
> That's not to say I don't want it to happen, because I do, but full
> NHibernate support is more important.
>
>
> On Fri, Jan 9, 2009 at 1:17 PM, Chris Bilson  wrote:
>
>> Thanks Paul.
>>
>> I did this and was able to do at least one of the bullets I mentioned - I
>> wanted a mapping visitor that didn't write to files. This was pretty simple
>> and not too interesting. Nevertheless, I cloned FNH to 
>> githubif anyone is 
>> interested in what I did.
>>
>> To James' point about decoupling, that's where I was going to go next. I
>> was always intrigued by the idea of using the NHibernate class meta data to
>> do other things and Fluent NH ClassMaps are far easier to work with. If only
>> you could associate a little more meta data with ProperyMaps and ClassMaps,
>> it would be easier to generate scaffolding and do other cross cutting work
>> against the model.
>>
>> Anyway, I will continue making small changes to the FNH source and
>> exploring these ideas since it doesn't sound too far from the intended
>> design. Thanks!
>>
>>
>> --c
>>
>>
>>
>> On Thu, Jan 8, 2009 at 5:58 PM, Paul Batum  wrote:
>>
>>> Hi Chris,
>>>
>>> I am afraid that in its current state, even if the mappings were publicly
>>> accessible, you would struggle to extract all the necessary data from them.
>>> It is further complicated by the fact that you would want to access the data
>>> AFTER conventions have been applied, but in some cases the conventions only
>>> modify the output xml, not the model itself.
>>>
>>> I would encourage you to pull the source down, change it to public and
>>> try working against it - I suspect you will find that this is not quite as
>>> simple as making the mappings public.
>>>
>>> Paul Batum
>>>
>>>
>>> On Fri, Jan 9, 2009 at 5:30 AM, Chris Bilson  wrote:
>>>

 Sorry, subject should be "Persist_ence_Model"

 On Jan 8, 10:30 am, Chris Bilson  wrote:
 > Does it make sense to want a public property to access the mappings in
 > a persistent model? I can imagine many uses for this:
 >
 >  * I want a DiagnosticMappingVisitor that does not need to write to a
 > folder
 >  * I want to do some kind of post processing to the mappings
 >  * I want to build scaffolding (like rails style scaffolding) from the
 > metadata in the model
 >
 > This should be very easy to do, I was just wondering if this isn't
 > exposed on purpose. Thanks!


>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: PersistentModel -> Make Mappings Property

2009-01-09 Thread James Gregory
There are motions in place for moving away from explicit XML generation in
the mapping, so maybe one day you'll be able to do everything you want to.
However, it isn't our primary concern currently, and as long as there are
major unimplemented NHibernate features, it won't be.
That's not to say I don't want it to happen, because I do, but full
NHibernate support is more important.

On Fri, Jan 9, 2009 at 1:17 PM, Chris Bilson  wrote:

> Thanks Paul.
>
> I did this and was able to do at least one of the bullets I mentioned - I
> wanted a mapping visitor that didn't write to files. This was pretty simple
> and not too interesting. Nevertheless, I cloned FNH to 
> githubif anyone is 
> interested in what I did.
>
> To James' point about decoupling, that's where I was going to go next. I
> was always intrigued by the idea of using the NHibernate class meta data to
> do other things and Fluent NH ClassMaps are far easier to work with. If only
> you could associate a little more meta data with ProperyMaps and ClassMaps,
> it would be easier to generate scaffolding and do other cross cutting work
> against the model.
>
> Anyway, I will continue making small changes to the FNH source and
> exploring these ideas since it doesn't sound too far from the intended
> design. Thanks!
>
>
> --c
>
>
>
> On Thu, Jan 8, 2009 at 5:58 PM, Paul Batum  wrote:
>
>> Hi Chris,
>>
>> I am afraid that in its current state, even if the mappings were publicly
>> accessible, you would struggle to extract all the necessary data from them.
>> It is further complicated by the fact that you would want to access the data
>> AFTER conventions have been applied, but in some cases the conventions only
>> modify the output xml, not the model itself.
>>
>> I would encourage you to pull the source down, change it to public and try
>> working against it - I suspect you will find that this is not quite as
>> simple as making the mappings public.
>>
>> Paul Batum
>>
>>
>> On Fri, Jan 9, 2009 at 5:30 AM, Chris Bilson  wrote:
>>
>>>
>>> Sorry, subject should be "Persist_ence_Model"
>>>
>>> On Jan 8, 10:30 am, Chris Bilson  wrote:
>>> > Does it make sense to want a public property to access the mappings in
>>> > a persistent model? I can imagine many uses for this:
>>> >
>>> >  * I want a DiagnosticMappingVisitor that does not need to write to a
>>> > folder
>>> >  * I want to do some kind of post processing to the mappings
>>> >  * I want to build scaffolding (like rails style scaffolding) from the
>>> > metadata in the model
>>> >
>>> > This should be very easy to do, I was just wondering if this isn't
>>> > exposed on purpose. Thanks!
>>>
>>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: PersistentModel -> Make Mappings Property

2009-01-09 Thread Chris Bilson
Thanks Paul.

I did this and was able to do at least one of the bullets I mentioned - I
wanted a mapping visitor that didn't write to files. This was pretty simple
and not too interesting. Nevertheless, I cloned FNH to
githubif
anyone is interested in what I did.

To James' point about decoupling, that's where I was going to go next. I was
always intrigued by the idea of using the NHibernate class meta data to do
other things and Fluent NH ClassMaps are far easier to work with. If only
you could associate a little more meta data with ProperyMaps and ClassMaps,
it would be easier to generate scaffolding and do other cross cutting work
against the model.

Anyway, I will continue making small changes to the FNH source and exploring
these ideas since it doesn't sound too far from the intended design. Thanks!


--c


On Thu, Jan 8, 2009 at 5:58 PM, Paul Batum  wrote:

> Hi Chris,
>
> I am afraid that in its current state, even if the mappings were publicly
> accessible, you would struggle to extract all the necessary data from them.
> It is further complicated by the fact that you would want to access the data
> AFTER conventions have been applied, but in some cases the conventions only
> modify the output xml, not the model itself.
>
> I would encourage you to pull the source down, change it to public and try
> working against it - I suspect you will find that this is not quite as
> simple as making the mappings public.
>
> Paul Batum
>
>
> On Fri, Jan 9, 2009 at 5:30 AM, Chris Bilson  wrote:
>
>>
>> Sorry, subject should be "Persist_ence_Model"
>>
>> On Jan 8, 10:30 am, Chris Bilson  wrote:
>> > Does it make sense to want a public property to access the mappings in
>> > a persistent model? I can imagine many uses for this:
>> >
>> >  * I want a DiagnosticMappingVisitor that does not need to write to a
>> > folder
>> >  * I want to do some kind of post processing to the mappings
>> >  * I want to build scaffolding (like rails style scaffolding) from the
>> > metadata in the model
>> >
>> > This should be very easy to do, I was just wondering if this isn't
>> > exposed on purpose. Thanks!
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread Andrew Stewart
Hi James
Yeah that's correct, I think in theory you could even stick that helper
method in a loop for all classes in namespace or assembly.

Andy

On Fri, Jan 9, 2009 at 12:13 PM, James Gregory wrote:

> Andrew am I correct in thinking this...
>
> modeloPersistencia.ForTypesThatDeriveFrom(eb =>
>   eb.Version(d => d.Versao)
> .TheColumnNameIs("Versao")
> .SetAttributes(new Attributes {
>   {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
>   {"unsaved-value", "null"},
>   {"generated", "always"}}));
>
> Should be replaced by one for each entity that has the version column?
>
> modeloPersistencia.ForTypesThatDeriveFrom(eb =>
>   eb.Version(d => d.Versao)
> .TheColumnNameIs("Versao")
> .SetAttributes(new Attributes {
>   {"type", "ModeloOO.NH.
> UserTypeTimestamp,ModeloOO.NH"},
>   {"unsaved-value", "null"},
>   {"generated", "always"}}));
>
> modeloPersistencia.ForTypesThatDeriveFrom(eb =>
>   eb.Version(d => d.Versao)
> .TheColumnNameIs("Versao")
> .SetAttributes(new Attributes {
>   {"type", "ModeloOO.NH.
> UserTypeTimestamp,ModeloOO.NH"},
>   {"unsaved-value", "null"},
>   {"generated", "always"}}));
>
>
> If I'm correct in that assumption... Luis, you could probably wrap this up
> in a little helper method for the time being. Something along the lines of:
>
> public void ConfigureVersion(PersistenceModel model)
> {
>   model.ForTypesThatDeriveFrom(eb =>
> eb.Version(d => d.Versao)
>   .TheColumnNameIs("Versao")
>   .SetAttributes(new Attributes {
> {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
> {"unsaved-value", "null"},
> {"generated", "always"}}));}
>
> Then in your auto mapping do this:
>
> // ... normal auto mapping stuff ...
> ConfigureVersion(modeloPersistencia);
> ConfigureVersion(modeloPersistencia);
>
> On Fri, Jan 9, 2009 at 12:04 PM, Andrew Stewart <
> andrew.stew...@i-nnovate.net> wrote:
>
>> Hi james
>> Thanks for looking at this for me. Yeah that makes sense as to why it's
>> producing no xml. Luis are your problems solved now? Unfortunalty there is
>> no automatic way to map your version column at this time, you'll have to
>> take your manual mapping and apply it in the FromDerivedFromClass for each
>> class in your solution.
>>
>> I think that should sort your issue out.
>>
>> Andy
>>
>> On Fri, Jan 9, 2009 at 11:48 AM, James Gregory 
>> wrote:
>>
>>> It's because with the AutoMapping, no mappings are actually generated
>>> until Configure is called.
>>> As for your other issue, I haven't forgotten about it I'm just not near a
>>> machine I can debug from. Hopefully tonight or sometime over the weekend
>>> I'll get a chance.
>>>
>>>
>>> On Fri, Jan 9, 2009 at 11:45 AM, Luis Abreu  wrote:
>>>
  Ok, that makes sense.



 Thanks,.



 ---

 Luis Abreu



 *From:* fluent-nhibernate@googlegroups.com [mailto:
 fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
 *Sent:* sexta-feira, 9 de Janeiro de 2009 09:39

 *To:* fluent-nhibernate@googlegroups.com
 *Subject:* [fluent-nhib] Re: question on auto mapping



 You're missing a call to Configure. Before calling
 modeloPersistencia.WriteMappingsTo(@"d:\"); call
 modeloPersistencia.Configure(nhibernateConfig);



 On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:

 Btw James, one more question:



 When using the auto persistence, shouldn't  I be able to save the xml to
 disk by using the previous code? It's that I get nothing and stopping the
 debugger there I see 0 mappings on the persistencemodel



 Thanks.





 ---

 Luis Abreu



 *From:* fluent-nhibernate@googlegroups.com [mailto:
 fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
 *Sent:* quinta-feira, 8 de Janeiro de 2009 16:27


 *To:* fluent-nhibernate@googlegroups.com
 *Subject:* [fluent-nhib] Re: question on auto mapping



 Hello Luis,



 I'm away from a machine with Visual Studio on right now, so I don't know
 how much help I can be, but lets try to work through your problem.



 Firstly, why is it that you're using a IUserType for your version? What
 is the type that your version property has in your entity? I ask that
 because Fluent NHibernate has a few options for mapping Versions and
 Timestamps.

- If you call your property Timestamp and give it a type of TimeSpan,
Fluent NHibernate will automatically map that to a Timestamp.
- If you call your property Version, and give it a type of int or
long, then it will map it as a Version.

  Are any of those possible options for you?



 On Thu, Jan 8, 2009 at 3:40 PM, Luis Abreu  wrote:


 Btw, one more stupid question. If I 

[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread James Gregory
Andrew am I correct in thinking this...

modeloPersistencia.ForTypesThatDeriveFrom(eb =>
  eb.Version(d => d.Versao)
.TheColumnNameIs("Versao")
.SetAttributes(new Attributes {
  {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
  {"unsaved-value", "null"},
  {"generated", "always"}}));

Should be replaced by one for each entity that has the version column?

modeloPersistencia.ForTypesThatDeriveFrom(eb =>
  eb.Version(d => d.Versao)
.TheColumnNameIs("Versao")
.SetAttributes(new Attributes {
  {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
  {"unsaved-value", "null"},
  {"generated", "always"}}));

modeloPersistencia.ForTypesThatDeriveFrom(eb =>
  eb.Version(d => d.Versao)
.TheColumnNameIs("Versao")
.SetAttributes(new Attributes {
  {"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
  {"unsaved-value", "null"},
  {"generated", "always"}}));

If I'm correct in that assumption... Luis, you could probably wrap this up
in a little helper method for the time being. Something along the lines of:

public void ConfigureVersion(PersistenceModel model)
{
  model.ForTypesThatDeriveFrom(eb =>
eb.Version(d => d.Versao)
  .TheColumnNameIs("Versao")
  .SetAttributes(new Attributes {
{"type", "ModeloOO.NH.UserTypeTimestamp,ModeloOO.NH"},
{"unsaved-value", "null"},
{"generated", "always"}}));}

Then in your auto mapping do this:

// ... normal auto mapping stuff ...
ConfigureVersion(modeloPersistencia);
ConfigureVersion(modeloPersistencia);

On Fri, Jan 9, 2009 at 12:04 PM, Andrew Stewart <
andrew.stew...@i-nnovate.net> wrote:

> Hi james
> Thanks for looking at this for me. Yeah that makes sense as to why it's
> producing no xml. Luis are your problems solved now? Unfortunalty there is
> no automatic way to map your version column at this time, you'll have to
> take your manual mapping and apply it in the FromDerivedFromClass for each
> class in your solution.
>
> I think that should sort your issue out.
>
> Andy
>
> On Fri, Jan 9, 2009 at 11:48 AM, James Gregory wrote:
>
>> It's because with the AutoMapping, no mappings are actually generated
>> until Configure is called.
>> As for your other issue, I haven't forgotten about it I'm just not near a
>> machine I can debug from. Hopefully tonight or sometime over the weekend
>> I'll get a chance.
>>
>>
>> On Fri, Jan 9, 2009 at 11:45 AM, Luis Abreu  wrote:
>>
>>>  Ok, that makes sense.
>>>
>>>
>>>
>>> Thanks,.
>>>
>>>
>>>
>>> ---
>>>
>>> Luis Abreu
>>>
>>>
>>>
>>> *From:* fluent-nhibernate@googlegroups.com [mailto:
>>> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
>>> *Sent:* sexta-feira, 9 de Janeiro de 2009 09:39
>>>
>>> *To:* fluent-nhibernate@googlegroups.com
>>> *Subject:* [fluent-nhib] Re: question on auto mapping
>>>
>>>
>>>
>>> You're missing a call to Configure. Before calling
>>> modeloPersistencia.WriteMappingsTo(@"d:\"); call
>>> modeloPersistencia.Configure(nhibernateConfig);
>>>
>>>
>>>
>>> On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:
>>>
>>> Btw James, one more question:
>>>
>>>
>>>
>>> When using the auto persistence, shouldn't  I be able to save the xml to
>>> disk by using the previous code? It's that I get nothing and stopping the
>>> debugger there I see 0 mappings on the persistencemodel
>>>
>>>
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>> ---
>>>
>>> Luis Abreu
>>>
>>>
>>>
>>> *From:* fluent-nhibernate@googlegroups.com [mailto:
>>> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
>>> *Sent:* quinta-feira, 8 de Janeiro de 2009 16:27
>>>
>>>
>>> *To:* fluent-nhibernate@googlegroups.com
>>> *Subject:* [fluent-nhib] Re: question on auto mapping
>>>
>>>
>>>
>>> Hello Luis,
>>>
>>>
>>>
>>> I'm away from a machine with Visual Studio on right now, so I don't know
>>> how much help I can be, but lets try to work through your problem.
>>>
>>>
>>>
>>> Firstly, why is it that you're using a IUserType for your version? What
>>> is the type that your version property has in your entity? I ask that
>>> because Fluent NHibernate has a few options for mapping Versions and
>>> Timestamps.
>>>
>>>- If you call your property Timestamp and give it a type of TimeSpan,
>>>Fluent NHibernate will automatically map that to a Timestamp.
>>>- If you call your property Version, and give it a type of int or
>>>long, then it will map it as a Version.
>>>
>>>  Are any of those possible options for you?
>>>
>>>
>>>
>>> On Thu, Jan 8, 2009 at 3:40 PM, Luis Abreu  wrote:
>>>
>>>
>>> Btw, one more stupid question. If I have this:
>>>
>>>
>>> var modeloPersistencia =
>>> AutoPersistenceModel.MapEntitiesFromAssemblyOf()
>>>.Where(
>>>type => type == typeof (Disciplina)
>>>) //comecar com disciplina
>>>.WithConvention(convention =>
>>>{
>>>convention.DefaultLazyLoad =
>>> false;
>>>   

[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread Andrew Stewart
Hi james
Thanks for looking at this for me. Yeah that makes sense as to why it's
producing no xml. Luis are your problems solved now? Unfortunalty there is
no automatic way to map your version column at this time, you'll have to
take your manual mapping and apply it in the FromDerivedFromClass for each
class in your solution.

I think that should sort your issue out.

Andy

On Fri, Jan 9, 2009 at 11:48 AM, James Gregory wrote:

> It's because with the AutoMapping, no mappings are actually generated until
> Configure is called.
> As for your other issue, I haven't forgotten about it I'm just not near a
> machine I can debug from. Hopefully tonight or sometime over the weekend
> I'll get a chance.
>
>
> On Fri, Jan 9, 2009 at 11:45 AM, Luis Abreu  wrote:
>
>>  Ok, that makes sense.
>>
>>
>>
>> Thanks,.
>>
>>
>>
>> ---
>>
>> Luis Abreu
>>
>>
>>
>> *From:* fluent-nhibernate@googlegroups.com [mailto:
>> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
>> *Sent:* sexta-feira, 9 de Janeiro de 2009 09:39
>>
>> *To:* fluent-nhibernate@googlegroups.com
>> *Subject:* [fluent-nhib] Re: question on auto mapping
>>
>>
>>
>> You're missing a call to Configure. Before calling
>> modeloPersistencia.WriteMappingsTo(@"d:\"); call
>> modeloPersistencia.Configure(nhibernateConfig);
>>
>>
>>
>> On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:
>>
>> Btw James, one more question:
>>
>>
>>
>> When using the auto persistence, shouldn't  I be able to save the xml to
>> disk by using the previous code? It's that I get nothing and stopping the
>> debugger there I see 0 mappings on the persistencemodel
>>
>>
>>
>> Thanks.
>>
>>
>>
>>
>>
>> ---
>>
>> Luis Abreu
>>
>>
>>
>> *From:* fluent-nhibernate@googlegroups.com [mailto:
>> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
>> *Sent:* quinta-feira, 8 de Janeiro de 2009 16:27
>>
>>
>> *To:* fluent-nhibernate@googlegroups.com
>> *Subject:* [fluent-nhib] Re: question on auto mapping
>>
>>
>>
>> Hello Luis,
>>
>>
>>
>> I'm away from a machine with Visual Studio on right now, so I don't know
>> how much help I can be, but lets try to work through your problem.
>>
>>
>>
>> Firstly, why is it that you're using a IUserType for your version? What is
>> the type that your version property has in your entity? I ask that because
>> Fluent NHibernate has a few options for mapping Versions and Timestamps.
>>
>>- If you call your property Timestamp and give it a type of TimeSpan,
>>Fluent NHibernate will automatically map that to a Timestamp.
>>- If you call your property Version, and give it a type of int or long,
>>then it will map it as a Version.
>>
>>  Are any of those possible options for you?
>>
>>
>>
>> On Thu, Jan 8, 2009 at 3:40 PM, Luis Abreu  wrote:
>>
>>
>> Btw, one more stupid question. If I have this:
>>
>>
>> var modeloPersistencia =
>> AutoPersistenceModel.MapEntitiesFromAssemblyOf()
>>.Where(
>>type => type == typeof (Disciplina)
>>) //comecar com disciplina
>>.WithConvention(convention =>
>>{
>>convention.DefaultLazyLoad = false;
>>convention.FindIdentity = field =>
>> field.Name == "Id";
>>convention.GetTableName = type =>
>> String.Concat(type.Name, "s");
>>convention.GetVersionColumnName =
>> type =>  "Versao";
>>
>>  convention.GetPrimaryKeyNameFromType
>> = type => String.Concat("Id", type.Name);
>>convention.IsBaseType = type =>
>> type
>> == typeof (EntidadeBase);
>>});
>>
>> modeloPersistencia.WriteMappingsTo(@"d:\");
>>
>> Shouldn't I get the xml mapping file for class Disciplina on d:? I've
>> tried
>> and I get nothing there (interestingly, if I add the
>> modeloPersistencia.ForTypesThatDeriveFro method call then I
>> do
>> get the xml for EntidadeBase only (which I don't want)...
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> >
>


-- 
=
I-nnovate Software - Bespoke Software Development, uk wirral.
http://www.i-nnovate.net

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread James Gregory
It's because with the AutoMapping, no mappings are actually generated until
Configure is called.
As for your other issue, I haven't forgotten about it I'm just not near a
machine I can debug from. Hopefully tonight or sometime over the weekend
I'll get a chance.

On Fri, Jan 9, 2009 at 11:45 AM, Luis Abreu  wrote:

>  Ok, that makes sense.
>
>
>
> Thanks,.
>
>
>
> ---
>
> Luis Abreu
>
>
>
> *From:* fluent-nhibernate@googlegroups.com [mailto:
> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
> *Sent:* sexta-feira, 9 de Janeiro de 2009 09:39
>
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: question on auto mapping
>
>
>
> You're missing a call to Configure. Before calling
> modeloPersistencia.WriteMappingsTo(@"d:\"); call
> modeloPersistencia.Configure(nhibernateConfig);
>
>
>
> On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:
>
> Btw James, one more question:
>
>
>
> When using the auto persistence, shouldn't  I be able to save the xml to
> disk by using the previous code? It's that I get nothing and stopping the
> debugger there I see 0 mappings on the persistencemodel
>
>
>
> Thanks.
>
>
>
>
>
> ---
>
> Luis Abreu
>
>
>
> *From:* fluent-nhibernate@googlegroups.com [mailto:
> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
> *Sent:* quinta-feira, 8 de Janeiro de 2009 16:27
>
>
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: question on auto mapping
>
>
>
> Hello Luis,
>
>
>
> I'm away from a machine with Visual Studio on right now, so I don't know
> how much help I can be, but lets try to work through your problem.
>
>
>
> Firstly, why is it that you're using a IUserType for your version? What is
> the type that your version property has in your entity? I ask that because
> Fluent NHibernate has a few options for mapping Versions and Timestamps.
>
>- If you call your property Timestamp and give it a type of TimeSpan,
>Fluent NHibernate will automatically map that to a Timestamp.
>- If you call your property Version, and give it a type of int or long,
>then it will map it as a Version.
>
>  Are any of those possible options for you?
>
>
>
> On Thu, Jan 8, 2009 at 3:40 PM, Luis Abreu  wrote:
>
>
> Btw, one more stupid question. If I have this:
>
>
> var modeloPersistencia =
> AutoPersistenceModel.MapEntitiesFromAssemblyOf()
>.Where(
>type => type == typeof (Disciplina)
>) //comecar com disciplina
>.WithConvention(convention =>
>{
>convention.DefaultLazyLoad = false;
>convention.FindIdentity = field =>
> field.Name == "Id";
>convention.GetTableName = type =>
> String.Concat(type.Name, "s");
>convention.GetVersionColumnName =
> type =>  "Versao";
>convention.GetPrimaryKeyNameFromType
> = type => String.Concat("Id", type.Name);
>convention.IsBaseType = type => type
> == typeof (EntidadeBase);
>});
>
> modeloPersistencia.WriteMappingsTo(@"d:\");
>
> Shouldn't I get the xml mapping file for class Disciplina on d:? I've tried
> and I get nothing there (interestingly, if I add the
> modeloPersistencia.ForTypesThatDeriveFro method call then I
> do
> get the xml for EntidadeBase only (which I don't want)...
>
> Thanks.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread Luis Abreu
Ok, that makes sense.

 

Thanks,.

 

---

Luis Abreu

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: sexta-feira, 9 de Janeiro de 2009 09:39
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: question on auto mapping

 

You're missing a call to Configure. Before calling
modeloPersistencia.WriteMappingsTo(@"d:\"); call
modeloPersistencia.Configure(nhibernateConfig);

 

On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:

Btw James, one more question:

 

When using the auto persistence, shouldn't  I be able to save the xml to
disk by using the previous code? It's that I get nothing and stopping the
debugger there I see 0 mappings on the persistencemodel

 

Thanks.

 

 

---

Luis Abreu

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: quinta-feira, 8 de Janeiro de 2009 16:27


To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: question on auto mapping

 

Hello Luis,

 

I'm away from a machine with Visual Studio on right now, so I don't know how
much help I can be, but lets try to work through your problem.

 

Firstly, why is it that you're using a IUserType for your version? What is
the type that your version property has in your entity? I ask that because
Fluent NHibernate has a few options for mapping Versions and Timestamps.

*   If you call your property Timestamp and give it a type of TimeSpan,
Fluent NHibernate will automatically map that to a Timestamp.
*   If you call your property Version, and give it a type of int or
long, then it will map it as a Version.

Are any of those possible options for you?

 

On Thu, Jan 8, 2009 at 3:40 PM, Luis Abreu  wrote:


Btw, one more stupid question. If I have this:


var modeloPersistencia =
AutoPersistenceModel.MapEntitiesFromAssemblyOf()
   .Where(
   type => type == typeof (Disciplina)
   ) //comecar com disciplina
   .WithConvention(convention =>
   {
   convention.DefaultLazyLoad = false;
   convention.FindIdentity = field =>
field.Name == "Id";
   convention.GetTableName = type =>
String.Concat(type.Name, "s");
   convention.GetVersionColumnName =
type =>  "Versao";
   convention.GetPrimaryKeyNameFromType
= type => String.Concat("Id", type.Name);
   convention.IsBaseType = type => type
== typeof (EntidadeBase);
   });

modeloPersistencia.WriteMappingsTo(@"d:\");

Shouldn't I get the xml mapping file for class Disciplina on d:? I've tried
and I get nothing there (interestingly, if I add the
modeloPersistencia.ForTypesThatDeriveFro method call then I do
get the xml for EntidadeBase only (which I don't want)...

Thanks.





 

 

 

 

 




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: question on auto mapping

2009-01-09 Thread James Gregory
You're missing a call to Configure. Before calling modeloPersistencia.
WriteMappingsTo(@"d:\"); call
modeloPersistencia.Configure(nhibernateConfig);
On Thu, Jan 8, 2009 at 9:57 PM, Luis Abreu  wrote:

>  Btw James, one more question:
>
>
>
> When using the auto persistence, shouldn't  I be able to save the xml to
> disk by using the previous code? It's that I get nothing and stopping the
> debugger there I see 0 mappings on the persistencemodel
>
>
>
> Thanks.
>
>
>
>
>
> ---
>
> Luis Abreu
>
>
>
> *From:* fluent-nhibernate@googlegroups.com [mailto:
> fluent-nhibern...@googlegroups.com] *On Behalf Of *James Gregory
> *Sent:* quinta-feira, 8 de Janeiro de 2009 16:27
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: question on auto mapping
>
>
>
> Hello Luis,
>
>
>
> I'm away from a machine with Visual Studio on right now, so I don't know
> how much help I can be, but lets try to work through your problem.
>
>
>
> Firstly, why is it that you're using a IUserType for your version? What is
> the type that your version property has in your entity? I ask that because
> Fluent NHibernate has a few options for mapping Versions and Timestamps.
>
>- If you call your property Timestamp and give it a type of TimeSpan,
>Fluent NHibernate will automatically map that to a Timestamp.
>- If you call your property Version, and give it a type of int or long,
>then it will map it as a Version.
>
>  Are any of those possible options for you?
>
>
>
> On Thu, Jan 8, 2009 at 3:40 PM, Luis Abreu  wrote:
>
>
> Btw, one more stupid question. If I have this:
>
>
> var modeloPersistencia =
> AutoPersistenceModel.MapEntitiesFromAssemblyOf()
>.Where(
>type => type == typeof (Disciplina)
>) //comecar com disciplina
>.WithConvention(convention =>
>{
>convention.DefaultLazyLoad = false;
>convention.FindIdentity = field =>
> field.Name == "Id";
>convention.GetTableName = type =>
> String.Concat(type.Name, "s");
>convention.GetVersionColumnName =
> type =>  "Versao";
>convention.GetPrimaryKeyNameFromType
> = type => String.Concat("Id", type.Name);
>convention.IsBaseType = type => type
> == typeof (EntidadeBase);
>});
>
> modeloPersistencia.WriteMappingsTo(@"d:\");
>
> Shouldn't I get the xml mapping file for class Disciplina on d:? I've tried
> and I get nothing there (interestingly, if I add the
> modeloPersistencia.ForTypesThatDeriveFro method call then I
> do
> get the xml for EntidadeBase only (which I don't want)...
>
> Thanks.
>
>
>
>
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate Integration Facility

2009-01-09 Thread Stefan Lieser

Hi Chad,

any reason for using 2.0 instead of 2.0.1?

Cheers,
Stefan Lieser
--
http://nhplugin.lieser-online.de

Chad Myers schrieb:
> FYI, there's a Rake target for switching the binaries.  From the trunk/ 
> folder, type "rake -T".
>  
> These tasks are of particular interest:
>  
> rake nhib21   # Builds Fluent NHibernate against the NHibernate 2.1 
> lib...
> rake use_nhib_20  # Switches NHibernate dependencies to NHibernate 2.0
> rake use_nhib_21  # Switches NHibernate dependencies to NHibernate 2.1
> 
> 
> 
> From: fluent-nhibernate@googlegroups.com on behalf of Chris Bilson
> Sent: Thu 1/8/2009 1:44 PM
> To: Fluent NHibernate
> Subject: [fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate 
> Integration Facility
> 
> 
> 
> 
> The 2.1 NH binaries are in the FNH tree. I've just been copying those
> into the parent directory (where the c# projects get their references)
> and rebuilding building FNH.
> 
> I ended up ditching the castle NH facility, after using it for many
> years. I realized what it does is really pretty simple, so I just
> built my own Unit of work implementation that handles session
> management, per request sessions and transactions in web apps, and of
> course integrating with FNH for configuring session factories.
> 
> If anyone else is doing this it would be interesting to exchange
> ideas.
> 
> On Jan 8, 10:42 am, "Sebastien Lambla"  wrote:
>> No luck with the trunk of castle though as it relies on 2.1 and fluent
>> nhibernate so far seems compiled against 2.0.
>>
>> Is there a way to change that when compiling fluent nhibernate? Or is there
>> a 2.0 compat nhibernate facility in castle?
>>
>> I've had to revert to using a SessionManager and manage my sessions myself.
>> Not nice!
>>
>> -Original Message-
>> From: fluent-nhibernate@googlegroups.com
>>
>> [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Mike Hadlow
>> Sent: 08 January 2009 17:02
>> To: Fluent NHibernate
>> Subject: [fluent-nhib] Re: Fluent NHibernate and the Windsor NHibernate
>> Integration Facility
>>
>> Woops, sorry that code above won't work. You have to create you own
>> IConfigurationBuilder. This one is tested and works:
>>
>> /// 
>> /// Default imlementation of 
>> /// 
>> public class FluentNHibernateConfigurationBuilder :
>> IConfigurationBuilder
>> {
>> /// 
>> /// Builds the Configuration object from the specifed configuration
>> /// 
>> /// 
>> /// 
>> public Configuration GetConfiguration(IConfiguration config)
>> {
>> Configuration cfg = new Configuration();
>>
>> ApplyConfigurationSettings(cfg,
>> config.Children["settings"]);
>>
>> cfg.AddMappingsFromAssembly(typeof(Order).Assembly);
>>
>> AdditionalConfiguration(config, cfg);
>>
>> return cfg;
>> }
>>
>> /// 
>> /// Override this method to provide additional configuration
>> /// 
>> /// 
>> /// 
>> public virtual void AdditionalConfiguration(IConfiguration config,
>> Configuration cfg) {}
>>
>> /// 
>> /// Applies the configuration settings.
>> /// 
>> /// The CFG.
>> /// The facility config.
>> protected void ApplyConfigurationSettings(Configuration cfg,
>> IConfiguration facilityConfig)
>> {
>> if (facilityConfig == null) return;
>>
>> foreach (IConfiguration item in facilityConfig.Children)
>> {
>> String key = item.Attributes["key"];
>> String value = item.Value;
>>
>> cfg.SetProperty(key, value);
>> }
>> }
>> }
> 
> 
> 
> 
> > 
> 
> 
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.176 / Virus Database: 270.10.5/1882 - Release Date: 08.01.2009 
> 08:13
> 

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[fluent-nhib] Re: PersistentModel -> Make Mappings Property

2009-01-09 Thread James Gregory
Seconded. This isn't the kind of thing you can really do until we uncouple
the mapping from the hbm.xml.

On Fri, Jan 9, 2009 at 1:58 AM, Paul Batum  wrote:

> Hi Chris,
>
> I am afraid that in its current state, even if the mappings were publicly
> accessible, you would struggle to extract all the necessary data from them.
> It is further complicated by the fact that you would want to access the data
> AFTER conventions have been applied, but in some cases the conventions only
> modify the output xml, not the model itself.
>
> I would encourage you to pull the source down, change it to public and try
> working against it - I suspect you will find that this is not quite as
> simple as making the mappings public.
>
> Paul Batum
>
>
> On Fri, Jan 9, 2009 at 5:30 AM, Chris Bilson  wrote:
>
>>
>> Sorry, subject should be "Persist_ence_Model"
>>
>> On Jan 8, 10:30 am, Chris Bilson  wrote:
>> > Does it make sense to want a public property to access the mappings in
>> > a persistent model? I can imagine many uses for this:
>> >
>> >  * I want a DiagnosticMappingVisitor that does not need to write to a
>> > folder
>> >  * I want to do some kind of post processing to the mappings
>> >  * I want to build scaffolding (like rails style scaffolding) from the
>> > metadata in the model
>> >
>> > This should be very easy to do, I was just wondering if this isn't
>> > exposed on purpose. Thanks!
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---