0

Ok, so I get that Edge-SQL let's you write T-SQL statements directly in your node.js code.

Awesome.

But I have legacy DLL's that access a DB on their own which I need to integrate into a node.js app. Basically, I have a set of DLL's responsible for building data objects from a DB I would like to expose via .NET async methods, which currently pass the data objects back to an ASP.NET front-end. The goal is to be able to replace the ASP.NET front-end with a node.js front-end utilizing the same data DLL's from the legacy app.

My questions are:

  1. Is it possible to use those DLL's in a node.js context using edge.js? and if so,
  2. Is the only issue with doing so properly passing in a connection string? and
  3. How would I pass in the DB Connection which is normally within the web.config for those DLL's to take advantage of?

EDIT

Similar to this question: Using a .NET DLL in Node.js / serverside javascript except no details on how to handle the connection strings and this question Connect to SQL Server database from Node.js.

Obviously the two can work in conjunction, but curious as to how to make it work with DB calls coming from compiled DLLs but the web app the DLLs are used in is an express.js/node.js app.


EDIT 2

To clarify, the goal is to have a .cs/.csx file(s) that I can call methods from, passing in parameters (from URL) from node to pass to the methods in the .cs/.csx files that in turn call into the pre-compiled DLL's included in the project. It is those DLL's that have the calls to the DB which are in need of a connection string being passed in.

Community
  • 1
  • 1
mindpivot
  • 341
  • 3
  • 17

1 Answers1

2

Is it possible to use those DLL's in a node.js context using edge.js?

Yes (depending on what you mean by "those")

Is the only issue with doing so properly passing in a connection string?

Not sure what you mean by that. If your library is accessing your database, you could stuff your connectionStrings down into its config file, add a System.Configuration reference in the library and pull the connectionString out of ConfigurationManager.

How would I pass in the DB Connection which is normally within the web.config for those DLL's to take advantage of?

Why don't you move your connection string to node.exe.config? That is your "web.config" when using edge.

Copy your node executable to your project path. If you've forgotten where your executable is, you can console.log(process.execPath) on server start up and it'll point you right to it. Touch node.exe.config and copy paste your web.config settings into the new node.exe.config file.

K. Alan Bates
  • 3,104
  • 5
  • 30
  • 54