Hi Chad,

thats a good idea! I would prefer this over the lambda syntax you posted 
before.

And we could have both: fluent api and initializer syntax.

ConnectionString.Is(
     ConnectionString
        .Server(“foo”)
        .Database(”bar”))

vs.

ConnectionString.Is(
     new ConnectionString {
        Server = “foo”,
        Database = ”bar”});


BUT I see one problem with this: discoverability. The 
ConnectionStringExpression classes have the necessary properties so that 
you will find them in IntelliSense. With the ConnectionString class you 
have to know that it exists.

And the second problem is with different databases. There will be an 
MsSqlConnectionstring and a PostgreSqlConnectionString. To make this 
"typesafe" we need special parameter types for the In(...) method.

So maybe its better to stick with the solution we just started?


Cheers,
Stefan Lieser


Chad Myers schrieb:
> Hrm. What if we had a separate connection string builder that might have 
> wider applicability (outside of Fluent NHib).
> 
>  
> 
> Fluent NHib could use it, as could any one else.
> 
>  
> 
> ConnectionString.Is( new ConnectionString{ Server = “foo”, 
> Database=”bar”, etc, etc} );
> 
>  
> 
> Of course, the ConnectionString object could have a fluent API as well.
> 
>  
> 
> Thoughts?
> 
>  
> 
> -c
> 
>  
> 
> *From:* fluent-nhibernate@googlegroups.com 
> [mailto:[EMAIL PROTECTED] *On Behalf Of *Dru Sellers
> *Sent:* Saturday, September 13, 2008 10:35 AM
> *To:* fluent-nhibernate@googlegroups.com
> *Subject:* [fluent-nhib] Re: Fluent ConfigurationString
> 
>  
> 
> Q1. Do we like the idea of a connection string builder?
> 
> A1. Yes
> 
> Q2. Does it have to hang off of the NHConfig object?
> 
> A2. No
> 
> Q3. What's wrong with your lambda?
> 
> A3. ??
> 
>  
> 
> -d
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> On Sat, Sep 13, 2008 at 10:22 AM, Chad Myers <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> The problem is, you have a sub-FI for the connection string and you're 
> "on that path" so there is no 'ToProperties' on the 
> 'ConnectionStringExpression' (or whatever it'll be called)
> 
>  
> 
> Unless we put it there, but then that will end the ENTIRE config path. 
> What if you want to add other config properties AFTER your connection 
> string?
> 
>  
> 
> We could say that the connection string MUST be the last one, but I'm 
> not crazy about that idea, either.
> 
>  
> 
> -c
> 
>  
> 
> *From:* fluent-nhibernate@googlegroups.com 
> <mailto:fluent-nhibernate@googlegroups.com> 
> [mailto:fluent-nhibernate@googlegroups.com 
> <mailto:fluent-nhibernate@googlegroups.com>] *On Behalf Of *Dru Sellers
> *Sent:* Saturday, September 13, 2008 10:16 AM
> 
> 
> *To:* fluent-nhibernate@googlegroups.com 
> <mailto:fluent-nhibernate@googlegroups.com>
> 
> *Subject:* [fluent-nhib] Re: Fluent ConfigurationString
> 
>  
> 
> The 'create' could be called internally when the .ToProperties is called.
> 
>  
> 
> -d
> 
> On Sat, Sep 13, 2008 at 10:17 AM, Chad Myers <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> 
> Yeah, cool stuff!
> 
> I'm not super crazy about the 'Create' though.  For some reason,
> dead-end paths smell to me. I'm not sure why, because it's not that bad.
> 
> How 'bout
> 
> .ConnectionString.Is(c=>c
> 
>        .Server("db-srv")
>        .Database("tables")
> 
>        .Username("scott")
>        .Password("tiger"))
> .ToProperties();
> 
> ?? Is that much better. Maybe not, I dunno.
> 
> -c
> 
> 
> -----Original Message-----
> From: fluent-nhibernate@googlegroups.com 
> <mailto:fluent-nhibernate@googlegroups.com>
> [mailto:fluent-nhibernate@googlegroups.com 
> <mailto:fluent-nhibernate@googlegroups.com>] On Behalf Of Stefan Lieser
> Sent: Saturday, September 13, 2008 8:53 AM
> To: fluent-nhibernate@googlegroups.com 
> <mailto:fluent-nhibernate@googlegroups.com>
> Subject: [fluent-nhib] Fluent ConfigurationString
> 
> 
> Hi,
> 
> what do you think about a fluent way to build connection strings?
> 
> MsSqlConfiguration.MsSql2005
>     .ConnectionString
>         .Server("db-srv")
>         .Database("tables")
>         .Username("toni tester")
>         .Password("secret")
>         .Create
>     .ToProperties();
> 
> I've started to implement this and would contribute it as a patch.
> 
> 
> Cheers,
> Stefan Lieser
> --
> http://nhplugin.lieser-online.de
> 
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> 
> > 
> 
> ------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.169 / Virus Database: 270.6.21/1669 - Release Date: 12.09.2008 
> 14:18
> 

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to