Oh my~
[Note:I use nhibernate2.0.1 plus sql2008]

I met sth odd,i tryed all kinds of recipes but no settle.

1,The code below works like a charm,(using FluentConfiguration's
Database method):

            var factory1 = Fluently.Configure()
                .Database(
                    MsSqlConfiguration
                    .MsSql2005
                    .ConnectionString(x => x.Is
("server=XXX;database=XXX;uid=XXX;pwd=XXX"))
                    .ShowSql()
                )
                .Mappings(
                    x => x.AutoMappings.Add(
 
AutoPersistenceModel.MapEntitiesFromAssemblyOf<Category>()
                            .Where(y => y.Name == "Test")
                            .WithConvention(
                                z =>
                                {
                                    z.GetTableName = f =>
Inflector.Pluralize(f.Name);
                                }
                            )
                        )
                )
                .BuildSessionFactory();

            var session1 = factory1.OpenSession();

2,but this one below always throws an exception (use config file):
            var cfg1 = new Configuration().Configure("../../
Nhibernate.config");//absolute path also not work.
            var factory1 = Fluently.Configure(cfg1)
                .Mappings(
                    x => x.AutoMappings.Add(
 
AutoPersistenceModel.MapEntitiesFromAssemblyOf<Category>()
                            .Where(y => y.Name == "Test")
                            .WithConvention(
                                z =>
                                {
                                    z.GetTableName = f =>
Inflector.Pluralize(f.Name);
                                }
                            )
                        )
                )
                .BuildSessionFactory();

            var session1 = factory1.OpenSession();

The exception says:
  "cannot open connection",

and the innerexception is:
"A connection was successfully established with the server, but
then an error occurred during the login process. (provider: Shared
Memory Provider, error: 0 - No process is on the other end of the
pipe.)"

My Nhibernate.config is:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
        <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</
property>
        <property
name="connection.driver_class">NHibernate.Driver.SqlClientDriver</
property>
        <property
name="connection.connection_string">server=XXX;database=XXX;uid=XXX;pwd=XXX;</
property>
    </session-factory>
</hibernate-configuration>

I just don't know what's the difference between option 1 and option
2~~

Somebody can see sth?
--~--~---------~--~----~------------~-------~--~----~
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