2

I have library which contains some methods and property written in C# Language ,I want to access those methods from Node.js?

Below code is my C# Library code.

class Employee
{
    public int Id { get; set; }

    public string EmpName { get; set; }

    public DateTime EmpDob { get; set; }

    public Employee getEmpDetails()
    {
        Employee objEmployee = new Employee();

        objEmployee.Id = 11203256;

        objEmployee.EmpName = "John Miller";

        objEmployee.EmpDob = System.DateTime.Now;

        return objEmployee;
    }        
}

So above code produced Employee.dll , Now I want use my getEmpDetails() from node js.

Sudhir
  • 57
  • 8
  • This question is similar to http://stackoverflow.com/q/4653433/390421 You can use http://tjanczuk.github.io/edge/#/ to use dotnet DLLs from Javascript. – MartijnK Feb 17 '16 at 09:36
  • That artical is bit complex and not understandable. I am confused , Please if you can provide simple example it would be great help. – Sudhir Feb 17 '16 at 12:15
  • Examples looks like you can write c# code in node js , but I am looking for only use methods which is declared in my library. – Sudhir Feb 17 '16 at 13:14
  • You're right, Edge doesn't load the DLL, it executes C# code on the spot. It can load .cs files, which is neat. it is not easy to call a DLL function -- you need to add COM functionality like this: http://stackoverflow.com/a/8872518/390421 Mayve the Node.net project is usable. It's probably easier to just create a little WebAPI project to access your functionality. – MartijnK Feb 17 '16 at 13:39
  • @MartijnK: I did some analysis So I got I can use dlls but method should be asynchronous. But It just append 2 strings and returned, I don't what will happen complex logics. Refered:-http://mcluck90.tumblr.com/post/89814519378/getting-started-with-edgejs – Sudhir Feb 18 '16 at 07:48
  • That is very interesting. Edge does more than I saw at first. You should be able to use it, then, but you'll have to prepare your class for it -- It looks like you can use the method you already found to access it. Neat! – MartijnK Feb 18 '16 at 08:07
  • But my existing methods I don't want to touch it and it make asynchronous, I tried normal method which return only simple object so while compilng code it throws error. – Sudhir Feb 18 '16 at 09:38
  • If in your class doesn't have "Startup" Name then it also throwing error – Sudhir Feb 18 '16 at 10:36

0 Answers0