3

Seeking some advice how to best handle the following situation, I am a sole-programmer.

I am currently developing a C# Winforms application, new functionality that I am writing allows a user to create Processing.js sketches for data analysis purposes. I have built a Processing.js IDE (working) which allows the user to write and test Processing.js sketches and HTML code.

The final piece of the puzzle is to expose data from the database to the sketches.

What is the best approach I should investigate to acheive this?

Data resides in a Firebird database and is accessed/manipulated using NHibernate. Data access is written in C#, methods in the data access layer return objects from the database that are used throughout the application. Ideally I would like to access this data for the purposes of creating Processing sketches.

The Processing.js IDE also includes the jQuery library. How is it possible to retrieve database data using jQuery. Can I call the C# methods located in the data access layer.

Any advice is appreciated.

1
  • Generally JavaScript cannot interface with external code: of course, there are exceptions, like Silverlight (et al) and other environments including node.js. Perhaps Processing.js offers something similar? If "Processing.js IDE" does not offer such accessibility, what about running a "local web server" and exposing a WS endpoint? Commented Feb 13, 2013 at 3:57

3 Answers 3

1
  1. you will need a REST service, which you will call from UI using jQuery.

  2. your REST service will have to return a JSON result , otherwise it will make things more complicated.

  3. in UI you will call the webservice using $.ajax() function.

    once you got your results back from service , you can manipulate data in javascript and display it

Sign up to request clarification or add additional context in comments.

Comments

0

Probably the best way to do it is to create a web service (WCF or Asmx) for accessing data and let your client (Processing.js) fetch the data from there using JSON or XML once the page is loaded. Using such services with jQuery ajax method is trivial, and you'll get cleaner MVC-like environment on the client side.

So, to reiterate:

  1. Create a web service using C# and your existing methods to retrieve the data from the DB and send it to client over HTTP
  2. Access this service using ajax or similar functions from jQuery core library.
  3. Process the data on the client side and create the necessary DOM elements for fetched data.

Comments

0

You need to make an Ajax call(Web Method) to the server to send/receive the data. Your .NET code in the back-end would do the connection to the database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.