How to run CSLA with PostgreSQL in Linux

How to run CSLA with PostgreSQL in Linux

Old forum URL: forums.lhotka.net/forums/t/1468.aspx


kobruleht posted on Thursday, October 12, 2006

I'm interested to run CSLA framework with .NET data provider for PostgreSQL under Linux.

I think I need to use MONO for this.

How to use PostgreSQL database and run framework sample WinForms application in MONO ?

I tried google search but havent found any information about this.

Andrus.

 

guyroch replied on Thursday, October 12, 2006

No, you do not need Mono to do this if the only thing you will have on linux is the PostgrSQL database.  As long as your application server is a Windows Server with IIS all you need is a PostgreSQL .Net Data provider that will interact with you remote database on the linux box.  Your connection string will point to the db server.

Here is one PostgreSQL .Net Data provider...

http://www.download.com/PostgreSQLDirect-NET-Data-Provider/3000-10253_4-10388002.html

And here is a site that will help with any connectiong string problem you may have...

http://www.connectionstrings.com/

 

As an alternative to the PostgreSQL .Net Data provider you can use the System.Data.Common.DbProviderFactory if you are using .Net 2.0.  This is a generic data provider.

Hope this helps.

kobruleht replied on Thursday, October 12, 2006

My ultimata goal is to create WinForm or GTK# GUI application running under Linux.

I want to develop in using Visual C# 2005 Express Edition.

I prefer to use open source and free net data provider from http://pgfoundry.org/projects/npgsql

Is there any sample code for use CSLA with npgsql data provider ? Have anybody tired to run CSLA WinFor application in Linux ?

guyroch replied on Thursday, October 12, 2006

Clarification required...

Are you looking to "run" a CSLA based app (complete with db and business objects) on mono?

OR

Are you looking to only have the db on the linux server?

 

guyroch replied on Thursday, October 12, 2006

Okay, we posted at the same time and you pretty much answered my question - sorry.

I have not used a CSLA app with PostgreSQL but if you can connect to a PostgreSQL database using the sample connection strings provided in my previous post that istdoes not matter if your app is Csla based or not.  If you can connect from with .Net then you should be able to connect from your Csla BO's.

I have connect to databases such as SQL Server, Oracle, and Firebird in the past I they work fine, regardless of Csla or not.  So, I don't see any problems in you using PostgreSQL on a remote linux box.

kobruleht replied on Thursday, October 12, 2006

I need to port large GUI accounting application to Linux. This application in written in Microsoft Visual FoxPro so this will be complete code rewrite.

I created this application prototype: WinForm application which connects to PostgreSQL database using npgsql and allows edit data in DataGrid and uses MainMenu  (DataGridView and MenuStrip do not work in MONO, .NET 2 Winforms are mostly not implemented).

I have three choices now:

1. Find a GUI framework which supports MONO and Postgres. I tried but hav'ent found such.

2. Create my own framework.

3. Modify CSLA 2.1 (CSLA 1.1 fails to buid on VCS Express 2005 so I don't consider this) or some other framework.

Modifying CSLA 2.1 requires the following changes:

1. Change all .NET 2 Winforms controls to .NET 1.1 controls to work in current MONO

2. Change all other .NET 2 API calls to .NET 1.1 API calls to work in current MONO

3. Change CSLA database access logic to work with MONO and npgsql

So using CSLA seems to be huge work.

I need also a GUI report designer which can be used by end users. Currently I'm planning to use http://www.fyireporting.com

Can you recommend which way I must go ?

Andrus.

guyroch replied on Thursday, October 12, 2006

Sorry but this is where it ends for me.  You are walking into uncharted territory here.  Good luck.

Brian Criswell replied on Thursday, October 12, 2006

I see you going one of a couple routes:
1. Use Java.  It works natively on Linux and has lots of frameworks and such.  I have started thinking about what would be required to make CSLA.Java, but I need to see what frameworks already exist first.
2. Buy C# or VB.NET 2003 Standard for ~$75.  .NET 1.1 has a much higher chance of being implemented to the level you will need in Mono.
3. Use a virtual machine.  VMWare personal editions are free, but it requires a Windows license.
EDIT:
4. Use MonoDevelop.
5. Use SharpDevelop.

jkellywilkerson replied on Thursday, October 12, 2006

Is it possible to develop the app to run on IIS using CSLA BOs and Web Services and have the user interface a Mozilla-based (or other) web browser on a Linux client?  I assume this is a viable option.

kobruleht replied on Friday, October 13, 2006

1. Use Java.  It works natively on Linux and has lots of frameworks and such.  I have started thinking about what would be required to make CSLA.Java, but I need to see what frameworks already exist first.
 
Thank you. This would be great idea. Can you recommend a framework which can be used and has IDE comparable to VCS Express 2005 ?
 
2. Buy C# or VB.NET 2003 Standard for ~$75.  .NET 1.1 has a much higher chance of being implemented to the level you will need in Mono.
 
I'm thinking using C# Express 2005 but use only .NET 1.1 compatible controls.
This is free and allows to use generics and other .NET 2  features which exist in mono. This requires to manually change MainMenu contructor calling line in VCS generated MainMenu code since .NET 1.1 MainMenu constructor does not accept parameter.
 
What do you think how many hours it will take to make CSLA 2.1 sample Winforms application running in MONO using this approach ?
 
VMWARE and IIS services are not an option since I need to create Commercical Linux-only desktop application which can be run in single Linux computer without internet connection.
 
4. Use MonoDevelop
 
MonoDevelop seems to be more inconvenient and requires to use Linux.

 
What are advantages using SharpDevelop over VCS Express ? Sharpdevelop seems to be more inconvenient than VCS Express.

 

Andrus.

ajj3085 replied on Friday, October 13, 2006

As other's have said, you're in uncharted territory here.  The advantage of SharpDevlop is that you can target Mono as a framework directly. 

You will not be able to successfully target .Net 1.1 using VS2005.  You're going to make much moer work for yourself fighting it.  For example, VS2005 will use partial classes for forms.  .Net 1.1 compilers don't support that.  Do not go this route, you'll be in for a world of hurt.  If you want to target 1.1 (which will more likely run on Mono), use VS2003.  Each VS from 2002 (VS.Net) is targeted to a specific framework version, and that version ONLY. 

Your best bet is probably either 1) go the Java route.  I hear Eclipse is a great IDE and is free.  2)  Go the web application route.  This will require a Windows web server (Windows Server 2003, Web Edition is $800).  You'll need only this one server, which can talk to your Linux PostgreSql server.  The clients can be any browser you support (IE and Firefox are good targets).

RockfordLhotka replied on Thursday, October 12, 2006

I have never tried to build CSLA under mono, so I don't know how much work would be required to make that happen.

I do know that you could not run .NET clients against a server running in mono - at least not if you use the data portal to go across the network. The reason is that some .NET types serialize differently than the equivalent mono types, and so .NET and mono are not "wire compatible" in terms of serializing object graphs across the network.

What this means to you, is that you would be bridging platforms - and thus should use more of a service-oriented approach for communication between your clients and the server.

msk replied on Friday, October 13, 2006

I once tried Csla 1.x under mono.  Lack of practise makes linux hard work for me so I just ended up using the 'binaries' made by Visual Studio and runing those using mono.  All the tests passed, but I did have to make one change to resources.  This only happened because en-US is not my default locale.  I think there was an inconsitency in how the CLR implements resources.  Mono didn't replicate that inconsitency at the time, so I had to rename the default resource file in csla to resources.en-us.  The tests all worked just fine after that.  I'm not sure about how 2.0 would work, but I think I read that the mono project will support all 2.0 features by the end of the year. 

kobruleht replied on Friday, October 13, 2006

> You will not be able to successfully target .Net 1.1 using VS2005. 

I'm planning to target MONO .NET 2 profile using VCS Express 2005 and CSLA 2.1

> You're going to make much moer work for yourself fighting it.  For example, VS2005 will use partial classes for forms.  .Net 1.1 compilers don't support that. 

I tried MainForms and Datagrid in VCS Express 2005. Generated Winforms code contains partial classes. After removing parameter passed by generated code to MainMenu constructor manually this code runs in MONO.

> Do not go this route, you'll be in for a world of hurt.  If you want to target 1.1 (which will more likely run on Mono), use VS2003.

Please give any example why this hurts (partial classes work OK in MONO ). It seems that MONO supports .NET 2 version of C# well. 

.NET 1 classes WinForms support is not good. MainMenu implementation is incomplete.

.NET 2 WinForms classes do not work (DataGridView causes 100% CPU usage). Many .NET 2 classes are not implemented.

I do'nt know CSLA well (I'm planning to read the Book in this weekend). So I have no idea how many time it will take.

How to find the number of .NET 2 only classes which are used in CSLA ?

> Your best bet is probably either 1) go the Java route.  I hear Eclipse is a great IDE and is free. 

I do'nt know JAVA. Please re-confirm, is it most reasonable way to move to Java. I have heard that .NET is better than Java since it is newer design and Microsoft/MONO  has put more resources to it than Sun.

> 2)  Go the web application route.  This will require a Windows web server (Windows Server 2003, Web Edition is $800).  You'll need only this one server, which can talk to your Linux PostgreSql server.  The clients can be any browser you support (IE and Firefox are good targets).

I'm creating horizontal market application for people who want to avoid Windows. So using Windows is not possible.

> I once tried Csla 1.x under mono.  Lack of practise makes linux hard work for me so I just ended up using the 'binaries' made by Visual Studio and runing those using mono.

I have the same situation: no experience on Linux but wish to create application for Linux. I'm planning also to create CSLA based .exe and .dll files in VCS 2005 and

> All the tests passed, but I did have to make one change to resources.  This only happened because en-US is not my default locale.  I think there was an inconsitency in how the CLR implements resources.  Mono didn't replicate that inconsitency at the time, so I had to rename the default resource file in csla to resources.en-us.  The tests all worked just fine after that. 

Have you tried to run CSLA WinForm based application ?

> I'm not sure about how 2.0 would work, but I think I read that the mono project will support all 2.0 features by the end of the year

Where do you read this? I observe MONO lists. It seems that maybe Winforms 1.1 implementation may be completed in this year. Nobody knows .NET 2 Winforms completion date or even will this completed on not.

Andrus.

ajj3085 replied on Friday, October 13, 2006

Ok, sounds like Mono is further along than I had though.  I checked thier site yesterday (quickly) and didn't immediately find anything that indicated how far along they were to add in .net 2.0 support.

But if you really can target .Net 2 and have it work in mono, things should be much easier for you and in that case Java doesn't make as much sense (FWIW, Java is pretty similar to C#, just different class names).

kobruleht replied on Friday, October 13, 2006

>didn't immediately find anything that indicated how far along they were to add in .net 2.0 support.

I think that they (payed programmers working in Novell for MONO in Boston and volunteers in world) do'nt know it. This is open source project and it depends how much programmers join with it.

> But if you really can target .Net 2 and have it work in mono, things should be much easier for you and in that case Java doesn't make as much sense

Java has more frameworks available than C# since it is older. So what do you think should I switch to Eclipse/NetBeans or try to fight with MONO/CSLA 2.1 ?

Andrus.

ajj3085 replied on Friday, October 13, 2006

I honestly can't tell you.  I'm not sure there's a Csla like framework for Java though; you may find frameworks that claim to be, but they usually turn out to be Object relation mappers.  Those kinds of frameworks are fine, but they don't offer the same focus on the business ideas that Csla does.

The problem with Mono is that  you are at the mercy of what the developers have done so far.  There are large chunks missing as you state.  To use Csla reflection must be complete (which I imagine it is), events and delegates are also important.  Csla also makes use of the System.Security.Principals namespace, so IPrincipal must be present.

Of course for the Windows forms pieces, you can probably build your application in Gtk#.  Csla is a business framework, so it doesn't really care what UI you put on top of the business objects you create.  You may not get the nice databinding support like you would in Windows forms, so you may have more hand coding though.  I don't know, I haven't ever lookd at Gtk#, so that's something to investigate.

kobruleht replied on Monday, October 16, 2006

I tried to run C# Projectracker applications in MONO using VCS 2005 Express.

In my application I need to edit data in DataGrid.

Results:

CSLA 2 requires BindingList<T> class. This is not implemented in MONO. So CSLA 2 cannot used.

CSLA 1.1 uses VB .NET listview project. VCS 2005 Express cannot even open this project, so editing data in DataGrid is not possible.

So it seems that it is not possible to use CSLA with MONO.

Andrus.

ajj3085 replied on Monday, October 16, 2006

Does Mono support the interfaces, IBindingList?

If so, it should be possible to implement BindingList<T> yourself.. which you could give back to the Mono project if you wanted.

At any rate, you should be looking at Csla 1.53.  Even if you can't use the listview control (I assume that's what you mean by listview project) you could still be able to use that version in Mono.

Have you tried to compile just the Csla library itself, and not the same projects?

kobruleht replied on Monday, October 16, 2006

I'm trying csla10cs-060519.zip and ptracker10-040717.zip files, are they latest for .NET 1.1 ?

After commenting out all MSDN.DataListView.DataListView objects and  this.pnlStatus/pnlUser.Name assignments WinForms sample rans in MONO if I press Cancel in Login dialog.

I need to test editing data in WinForms DataGrid. I havent found any DataGrid object in .NET 1.1 sample.

Removing DataListView removes all tabular data presentation from sample application.

How to modify Project Tracker .NET 1.1 or create sample in other way which edits or at least presents data in DataGrid ? I think I need to try edit big PostgreSQL table in DataGrid for testing.

I'm not sure can .NET 1.1 WinForms bind CSLA object to DataGrid.

I do'nt have enough resources and knowledge to implement BindingList<T> control in MONO.

Andrus.

ChristianPena replied on Monday, October 16, 2006

Andrus,

This may not be "help", but you are planning on recreating an Accounting package (MAS 90? ACCPAC? :shudders:) on an open source platform that contains incomplete functionality. At the very least, you are taking the risk of running into a whole that you do not foresee now. If some piece of the MONO .NET library remains unimplemented, you will either have to implement it yourself or hope that others will do it for you.

You really are better off taking a look at Java. The bridge from C# to Java is not that wide. There are java application frameworks out there. CSLA is a great framework but you may very well end up losing time to implementation details that are out of your control.

Just a thought.

kobruleht replied on Tuesday, October 17, 2006

Christian, thank you.

Yes, I'm planning to recreate an GUI Accounting package which can be run in Linux/Mac. By reading you answer I undrestand now that this is very risky for this to use C#/MONO/CSLA and I should go using Java.

The only sample which I know is Compiere (www.compiere.org) its user interface is not familiar for Windows users. Where to find sample Java application or framework which has user interface familiar to Windows users and allows data editing in grid ?

Andrus.

ajj3085 replied on Monday, October 16, 2006

kobruleht:
I'm trying csla10cs-060519.zip and ptracker10-040717.zip files, are they latest for .NET 1.1 ?


No, the latest version built for .Net 1.1 is Csla 1.53.

As Rocky said, The DataListView isn't part of Csla per say, you can safely remove it.  There are other ways to get the data into the grid, including manual binding.. it will take more time but should not be difficult.

Databinding is also not quite as easy in .Net 1.1 as it is in 2.0, but it is certainly doable.

No matter what you decide to do (even if you decide to use Java)  you're going to have a lot of work to do.

Andy

msk replied on Tuesday, October 24, 2006

> Have you tried to run CSLA WinForm based application ?

Only a Hello World - that worked quite well!  I've not had any time to devote to it since. 

I just a bit of a play with it after reading a book called cross platform .NET development

http://www.amazon.com/Cross-Platform-NET-Development-Portable-NET-Microsoft/dp/1590593308

> I'm not sure about how 2.0 would work, but I think I read that the mono project will support all 2.0 features by the end of the year

OK I found the place that gave me that idea.  I may try Hello World 2.0 at the end of the year.  I think there are differing definitions of complete.  Some people talk about .NET and mean CLR others mean CLR and all the surrounding technologies.  The curse of marketing.  (notice I use upper case .NET as I was told MS marketing originally dictated that, except in the logo where it's lower case - there words too, allegedly). 

http://www.mono-project.com/Mono_Project_Roadmap#Mono_2.0

The book may be a good read for you.  I found it to be quite a good overview of the issues you may face and possible solutions. 

RockfordLhotka replied on Monday, October 16, 2006

Listview is just used to allow databinding to a listview control, it is totally optional and really has nothing to do with csla itself.

Rocky

-----Original Message--
From: "kobruleht"
To: "rocky@lhotka.net"
Sent: 10/16/06 12:16 PM
Subject: Re: [CSLA .NET] How to run CSLA with PostgreSQL in Linux

I tried to run C# Projectracker applications in MONO using VCS 2005 Express

Copyright (c) Marimer LLC