private static ISessionFactory CreateSessionFactory()
       {
           return Fluently.Configure()
               .Database(MsSqlConfiguration.MsSql2008
                   .ConnectionString(c => c

*.FromConnectionStringWithKey(**"MyStore.Properties.Settings.StoreConnectionString"**)*)
                        )
               .Mappings(m =>
                   m.FluentMappings
                       .AddFromAssemblyOf<Program>())
               .ExposeConfiguration(BuildSchema)
               .BuildSessionFactory();
       }


On Thu, Oct 8, 2009 at 1:45 AM, mpetro <m...@petruszak.com> wrote:

>
> Hopefully, this is what you want:
>
>        private static ISessionFactory CreateSessionFactory()
>        {
>            return Fluently.Configure()
>                 .Database(MsSqlConfiguration.MsSql2008
>                    .ConnectionString(c => c
>                         .FromAppSetting("connectionString"))
>                        )
>                .Mappings(m =>
>                    m.FluentMappings
>                        .AddFromAssemblyOf<Program>())
>                .ExposeConfiguration(BuildSchema)
>                .BuildSessionFactory();
>        }
>
>
> and this is from the app.config file:
>
>    <connectionStrings>
>        <add name="MyStore.Properties.Settings.StoreConnectionString"
>             connectionString="Data Source=.
> \SQLEXPRESS;AttachDbFilename=|DataDirectory|\Store.mdf;Integrated
> Security=True;User Instance=True"
>             providerName="System.Data.SqlClient" />
>    </connectionStrings>
>
>
> Thanks for looking into this, by the way.
>
>
>
> On Oct 7, 3:14 am, Mikael Henriksson <mik...@zoolutions.se> wrote:
> > That's not your initialization code. Paul was asking you to post your
> > Fluently.Configure.... there are numerous ways to use a connection
> string.
> > Is it an appSetting? connectionString?  etc.
> > .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c =>
> > c.FromConnectionStringWithKey("yourNamedConnectionString")))
> > .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c =>
> > c.FromAppSetting("YourKey")))
> > .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c =>
> >
> c.Is(ConfigurationManager.ConnectionString["yourNamedConnectionString"].ConnectionString))
> > .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c =>
> > c.Server("YourServer\Instance").Username("sa").Password("password")))
> >
> > So to help you out we need your whole configuration part.
> >
> > On Wed, Oct 7, 2009 at 4:47 AM, mpetro <m...@petruszak.com> wrote:
> >
> > > Straight from the app.config file:
> >
> > > connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|
> > > DataDirectory|\Store.mdf;Integrated Security=True;User Instance=True"
> >
> > > -mpetro
> >
> > > On Oct 6, 6:03 pm, Paul Batum <paul.ba...@gmail.com> wrote:
> > > > Okay, can you post your initialization code?
> >
> > > > On Wed, Oct 7, 2009 at 10:52 AM, mpetro <m...@petruszak.com> wrote:
> >
> > > > > In fact, I'm working through that example.  However, I can't get a
> > > > > connection to SQL Server Express.  The code errors and stops
> executing
> > > > > in the MsSqlConnectionStringBuilder.Create() method.
> >
> > > > > -mpetro
> >
> > > > > On Oct 6, 3:52 am, Paul Batum <paul.ba...@gmail.com> wrote:
> > > > > > Which example are you following exactly? I recommend you follow
> the
> > > > > getting
> > > > > > started guide on the wiki if you aren't already:
> > > > >http://wiki.fluentnhibernate.org/Getting_started
> >
> > > > > > On Mon, Oct 5, 2009 at 5:50 AM, mpetro <m...@petruszak.com>
> wrote:
> >
> > > > > > > Hi there.  I'm new to Fluent NHibernate and can't seem to get
> > > > > > > started.  I'm trying the First Example to make sure my
> installation
> > > > > > > works, but it stops with an error in the
> > > > > > > MsSqlConnectionStringBuilder.Create method with the message
> shown
> > > > > > > above.
> >
> > > > > > > I searched and found this:
> >
> > >http://www.mailinglistarchive.com/fluent-nhibernate@googlegroups.com/.
> > > > > ..
> >
> > > > > > > but this indicates that the problem was taken care of.
>  Somehow,
> > > I'm
> > > > > > > seem to having the same issue.
> >
> > > > > > > Is anybody having this same problem, or does someone have a
> > > solution
> > > > > > > that they wouldn't mind sharing?
> >
> > > > > > > I'm using V C# Express with SQLExpress, tried FNH from
> pre-built
> > > > > > > binaries and also built from source using Ruby.
> >
> > > > > > > Warm regards,
> > > > > > > mpetro
> >
>

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

Reply via email to