Pervasive configuration problem

53 views
Skip to first unread message

erzet

unread,
May 6, 2012, 12:18:56 PM5/6/12
to fluent-n...@googlegroups.com
First of all I would like to say hello to all of you as i'm a newcomer to the group and nhibernate/fluent at all.

I'm creating small library that would serve me as a service lib for future projects. The problem is that the main application is using Pervasive database which is not directly supported by fluent/nhiber so I've done some google on this matter. I've found this topic...

https://forum.hibernate.org/viewtopic.php?p=2378349

.. which of course gave me some basic clues on how to proceed. But I'm stucked right now with this issue.

I've created a special class that's a simple driver.

    public class PervasiveDriver : ReflectionBasedDriverISqlParameterFormatter
    {
        public PervasiveDriver() : base(
            "Pervasive.Data.SqlClient", 
            "Pervasive.Data.SqlClient.PsqlConnection",
            "Pervasive.Data.SqlClient.PsqlCommand")
        {
 
        }
 
        public override bool UseNamedPrefixInParameter
        {
            get { return true; }
        }
 
        public override bool UseNamedPrefixInSql
        {
            get { return true; }
        }
 
        public override string NamedPrefix
        {
            get { return "?"; }
        }
 
        string ISqlParameterFormatter.GetParameterName(int index)
        {
            return "?";
        }
 
        public override bool SupportsMultipleOpenReaders
        {
            get { return false; }
        }
    }

Then I've created a class which inherits PersistenceConfiguration. I'm trying to use native MsSql2000 dialect right now.

 internal class PervasiveConfiguration : PersistenceConfiguration<PervasiveConfiguration>
    {
        internal PervasiveConfiguration(string connectionString) : base()
        {
            Driver<Data.Driver.PervasiveDriver>();
            Dialect<NHibernate.Dialect.MsSql2000Dialect>();
            ConnectionString(connectionString);
            ShowSql();
        }
    }

When i'm building SessionFactory

var cfg = new PervasiveConfiguration(ConnectionString); SessionFactory = Fluently.Configure() .Database(cfg) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Mappings.KH>()) .BuildSessionFactory();

I'm getting this exception...

{"Could not find connection string setting (set connection.connection_string or connection.connection_string_name property)"}

So i'm not really sure what's wrong. Any help would be appreciated!


Reply all
Reply to author
Forward
0 new messages