Using Entity Framework in CFD code

Discussion in 'Call Flow Designer' started by Michael Gaillez, Apr 10, 2018.

Thread Status:
Not open for further replies.
  1. Michael Gaillez

    Joined:
    Apr 10, 2018
    Messages:
    5
    Likes Received:
    0
    Hello,

    Can I use Entity Framework in code used in the call flow designer?

    I see the dll is present in /usr/lib/3cxpbx but what version do I need to use?

    Tnx,

    Michael
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,154
    Likes Received:
    87
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Michael Gaillez

    Joined:
    Apr 10, 2018
    Messages:
    5
    Likes Received:
    0
    Yes I have read that article but 3CX /usr/lib/3cxpbx folder contains an Microsoft.EntityFrameworkCore.dll. That version is 2.0.0. Using entity framework version 1.0 would require me to overwrite that file but I guess that is not such a good idea :) So how to overcome this?

    Also setting the library to .NET CORE 1.0 gives me this error in CFD "uses 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'". Applying .NET Standard 1.3 resolves this issue
     
    #3 Michael Gaillez, Apr 10, 2018
    Last edited: Apr 10, 2018
  4. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,154
    Likes Received:
    87
    OK, let me explain what you need to do. At the moment, CFD apps are .NET Core 1.0 DLLs. In the near future we will update the CFD to produce .NET Core 2.0 DLLs. This is like this because until 3CX v15.5 SP2, 3CX was running on .NET Core 1.0, and now it has been upgraded, so we need to also update the CFD. Until we do this, the apps are .NET Core 1.0 and are loaded by 3CX without any problem as they are compatible.

    So, in order to work with the CFD, you need to use .NET Core 1.0 DLL references, and then in 3CX the version 2.0 will be used. As a result, you need to download from Nuget the DLL for .NET Core 1.0 and copy it to the CompilerDependencies folder into the 3CX CFD installation folder. This way, the DLL is used to build the app, and in runtime the DLL 2.0 will be taken from the 3CX installation folder.

    In order to get the right DLL from Nuget, you just need to create a project with Visual Studio adding a reference to the library you need. Then nuget will download all the versions of the DLL and you can copy the version you need from there. For example, nuget will download the DLLs to the following folder:
    C:\Users\USER_NAME\.nuget\packages\PACKAGE_NAME\PACKAGE_VERSION\lib\netstandard1.6

    You need to get the DLL for netstandard1.6 or netstandard1.3, check which folder you have.

    Kind regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Michael Gaillez

    Joined:
    Apr 10, 2018
    Messages:
    5
    Likes Received:
    0
    Hello,

    When I copy the files to /usr/lib/3cxpbx the 3CXQuemanager.log keeps telling me it cannot find the file :-(

    Error message : "System.IO.FileNotFoundException: Could not load file or assembly 'PhoneNumbers, Version=8.9.3.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified." I copied the packed .netstandard1.3 file to /usr/lib/3cxpbx with WinSCP. Capture.JPG
     
  6. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,154
    Likes Received:
    87
    Yes, you can't add your own DLLs to the 3CX bin folder. The QueueManager service will not load it. You can try to add a script to load the assembly from a specific location.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.