Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

Re: [NHibernate-development] mapping in c# via fluent interface?

Pierre Henri Kuat?

2007-12-12

Replies: Find Java Web Hosting

Author LoginPost Reply
You should try this approach with some complex mapping (like "list of components"...) to see if it stands the test.

By the way, what are the pros/cons compared to NHibernate.Mapping.Attributes?

Pierre Henri.


Jim Bolla <jim.bolla@gmail.com> wrote:
On Dec 10, 2007 11:45 PM, Ayende Rahien wrote:
> Drop the idea of a base class and use a mapper directly, I think.
> I like it.

Actually after letting it stew in my brain for a day or so, I don't
think the base class is all that bad. Normally I'm adverse to imposing
a base class because it limits the client's inheritance options, but
really we're talking about a class that is alternative declaration of
an XML file. Such a class shouldn't have any crazy behavior that would
be burdened by a base class. I think the implementation and usage
would actually be simpler, even it is lacking the sexiness of a
totally fluent interface. But I may use mini fluent interfaces for the
inner pieces. Imagine...

public class CustomerMapping: RootClassMapping
{
public override void Map()
{
SetTable("CUSTOMERS");

SetIdentity(Entity.Id)
.Column("CUST_ID")
.Generator(Native());

AddProperty(Entity.Name)
.Column("CUST_NAME")
.Nullable(false);

// and so on...
}
}

I think that has the perfect amount of whitespace and indentation and
lack of plumbing in my eyes.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development


Never miss a thing. Make Yahoo your homepage.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.