Integration with database PostgreSQL Open

May 6, 2013 at 1:13 PM
Thank you for your attention!

I have a project in NOF in health department of the city of Porto Velho - Rondonia Brazil. The project was started in version 5.4 and it works perfectly, but now I find myself in trouble.
The secretariat wishes to the second half of this year to change to an open database.

Currently use SQL Express with replication encoded into a master PostgreSQL.

But now I'm having trouble changing the persistence mechanism of NOF for PostgreSQL.

For any suggestions or would comb one walks to be followed to achieve this migration?

I'm grateful for the attention and the great tool developed by you.

May 6, 2013 at 6:44 PM
Glad to hear you have had a successful project already.

Naked Objects MVC should be able to work seamlessly with any database that has an Entity Framework (v4) provider. I have no personal experience of working with PostreSQL, but I came across the following blog posting from a Microsoft guy, which might be helpful:

He suggests that the provider he was using couldn't do database generation, but, if I have understood you correctly, that should not be a problem as you have already scripted the database from SQL Express to PostgreSQL.

I suggest that the first step is to try a very simple example of accessing the database via this provider using a console application (i.e. not Naked Objects). Once that's working OK, try specifying that provider through Web.config, and running it with the Naked Objects app.


P.S. Do tell us more about your app - we're always on the look out for new case examples.
May 7, 2013 at 3:53 PM
Again I am grateful for the attention.

Following your suggestion, check that there are several issues of configuration and implementation that require care so that it works correctly and accurately.

I wonder if ima implementation (extension) of a another persistopr like Telerik or NHibernate would be feasible using the interfaces package persistor?
May 7, 2013 at 4:01 PM
Yes, it is certainly possible to write alternative persistors for Naked Objects e.g. to work with NHibernate, or with a 'no-sql' database. You just need to implement the interface. There is also a set of tests you can run to check that your persistor is working.

If you are serious about doing this - and you would be willing to share your implementation with others open source (we intend to set up a Naked Objects Contrib project for this sort of thing - or you could just set up your own repository on GitHub, say) we can give you some guidance.

But I would also like to know more about the issues that you faced getting PostgreSql working - was that just with Naked Objects, or did you have issues getting even a console app running with the EF provider?
May 7, 2013 at 6:31 PM

First, the project it is a system for medical UPA24Hs unit (24-hour service 7 days a week, poe this critical mission).
The approach was made in DDD with SCRUM by a very small team of only two analysts / programmers. The client platform is Windows Server with SQL Express and the master that is physically distant is a platform on Debian Linux PostgreSQL 8. The replication is performed by a scheduler windowsservice system on the client side.
The most critical part was the security replicated the remainder is in the hub LINUX.

The problem is found directly in the project Console without NOF. some pitfalls that require attention of a very small team.

For this reason I think that replacing the current persistor (EF) for a Open with NHibernate or Telerik OpenAccess make the project easier and malleable to which that bank that the end customer wants.

I hereby request a mei this post aseguir walks so I can perform this task to replace the persistor without changing what is already approved and tested by you in this excellent tool which enabled a quick project and concistente.

Thanks again for your attention.
May 8, 2013 at 8:12 AM
OK. We are still wondering why you see the development of a new object persistor (for e.g. NHibernate) as an easier option than getting the EF provider for PostgreSQL working! However, if that is the way you want to go...

The first step is to grab the source code of the Naked Objects Framework (NOF), and make sure you can:
  1. Build it
  2. Run all the tests (there is no point writing any extension until you have all the tests running)
  3. Can run an app with the framework source code and debug into it.
Then you will need to write an implementation of INakedObjectPersistor - which is the bulk of the work. You will also need to write an implementation of IObjectPersistorInstaller so that you can install your persistor from the Run class - but that's pretty easy, as you can just sub-class AbstractObjectPersistorInstaller.

You can refer to our code for the EntityPersistor and EntityPersistorInstaller for reference.

There is a C# project: NakedObjects.Persistor.Test, which our entity persistor tests call into - you can do the same. If all those tests pass you should be OK.

Good luck.

May 8, 2013 at 1:09 PM

As working for the public sector, has been downloaded an ordinance to change all opensource tools, and there are limits on the feasibility of SQL express purchase a license for the same, I'm not feasible.
This forced me to change the search persistor.

Very grateful for the help.