c# - NHibernate or FluentNHibernate doesn't seem to handle NpgsqlException [Resolved] -


I try to connect with both PostgreSQL and SQL Server databases with Fluent NHibernate I think this user is likely to handle a When I run the trial when I run the trial, I receive a message like "NGPsqlException is not a user code" when I use PostgreSQL when I try with SQL Server, then fix SqlException PostgreSQL handles with

  Try {this.sessionFactory = Fluently.Configure (). To have the connection code in your application, I host name + "; port =" + this.iGreffeDesktop.Port + "; database =" + this.iGreffeDesktop.Database + "; User ID =" + this.iGreffeDesktop.Username + " ; Password = "+ this.iGreffeDesktop.Password +"; "). Mappings (M => M. Fullent Mappings.AdphomasankAfFlt; compacts & gt; ()). Build Sessions ();} Grip (Exception E) {This. Terror = "Connection Error !!!"; }  

and try

  for SQL Server {this.sessionFactory = fluently.Configure (). Database (MsSqlConfiguration.MsSql2005.ConnectionString (@ " Server = "+ This.iGreffeDesktop.Hostname +"; Initial list = "+ this.iGreffeDesktop.Database +"; user = "+ this.iGreffeDesktop.Username +"; password = "+ this.iGreffeDesktop.Password +"; " Show SQL (.) Mappings (M => M. Fullent Mappings.AdformAssankAffplette  Cottages & gt; ()). Build Session ();} Grip (Exception e) {This.error = "Connection Error !!! "}}  

I used the NHibernate 2.1.2.4 on Net 3.5 I tried to handle NpgsqlException but the error message still appears whether something in my code is missing or is it a NHibernate bug?

Edit: It seems that there is a small problem originally.I have written a connection form with Visual Studio C # which is running inside the AutoCAD environment. The user enters the connection information inside the form and my script T tries to connect to the database. The purpose of the above code is to try to connect to a database and if not, then gives the error message to the user.

I have tried the code above by changing the "Comptes" class by "ComptesMap" class to see what happened to the NHibernate Comptes mapping class. I found that for the first time I run scripts inside AutoCAD , Then the script connects to any database, even that which does not exist !!! After closing the AutoCAD and reopening it, I run the script again and then I get the NPGXx access on any PostGrace SQL database, even if there is anything !!!

I really have trouble. It suggests an environmental problem. I'm a novice to use NHibernate. I try to connect to the code found on the web. I do not understand that my code What's wrong in

I have the persistence of the object in my script, which is related to this question and which states that Why do I get successful connections for the first time, others are also successful

But I found out how to handle flute NIBNET exception in this article:

I just change my code by:

  Try ... constructing session to factor both types of databases (fluenNHbernnet.f.fluent configuration option e) {This.error = e.InnerException.Message; }  

And now, it shows the user whether the connection has failed or not.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -