1

I have a Windows desktop application (developed with C# using .NET 2.0 framework) that I would like to connect to a rails web app. The scenario would ideally work as follows:

User runs the Windows desktop app and generates some results. The desktop application then uploads the results to a database that the Rails web app can manipulate and do interesting this with (for instance, make pretty graphs).

My experience with .NET is limited but I have a fairly strong background in RoR. I am currently tripped up on which type of database to use as well as how to make the two applications manipulate the same database. Any suggestions?

3 Answers3

2
  1. You can use any database that's available to you. .NET or ROR will not limit your options.

  2. You can have the rails app poll the database for said data (Not so good). OR you could develop a web service and have the desktop application call it to trigger the data manipulation.

Web services on rails.

How to consume webservices in C# winforms

More on consuming web services in C# winforms

Community
  • 1
  • 1
Chukwuemeka
  • 342
  • 6
  • 11
0

The database can be anything you want that both .NET and RoR can communicate with. I'm not a RoR expert, but .NET can talk to just about any db you want.

The communication between the apps happens via the database. You insert / manipulate the data via the C# app, then read the data and process it with the RoR app. There really should be no direct (app to app) communication between the two apps.

squillman
  • 13,363
  • 3
  • 41
  • 60
0

"I am currently tripped up on which type of database to use"

Name your poison! :) You can talk to practically every database on the planet from both .NET and Ruby/RoR, including:

  • Relational databases like SQL Server, DB2, Oracle, MySql, ProgreSQL, etc.
  • Document-databases like MongoDB, CouchDB, RavenDB, etc.
  • Other NOSQL key value stores including Cassandra, Dynamo, Riak, Redis, Memcache, Azure Table Storage, etc.

Pick one that meets your needs and go for it.

"how to allow communication between the two applications"

I am not quite sure what you mean by this, but I'll assume that you mean that at some point, after uploading its data, your app should open a web page displaying a nice graph of the data? If so, this is trivial and requires no direct integration between your .NET app and your RoR site other than your .NET app spawning an instance of a web browser, and asking it to open a given web page:

var process = new Process();
process.StartInfo.FileName = "iexplore";
process.StartInfo.Arguments = @"http:\\myreportgenerator.com?customerid=1234";
process.Start();

If you want your .NET app to be able to ask your RoR site to do specific things, then consider adding a REST web services API to your RoR site.

Go one step further and you could actually eliminate all DB code from your .NET app and just have it ask for and send data to your RoR site via REST (JSON/XML over HTTP) calls, performing all DB IO internally.

Rich Turner
  • 10,800
  • 1
  • 51
  • 68