Connecting to EntityFramwork

Created at 16 Sep 2020, 16:59
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BE

beedge72

Joined 16.09.2020

Connecting to EntityFramwork
16 Sep 2020, 16:59


I am trying to write a very simple proof of concept program that will connect to and read a value from database

When I run it I get the following error:

16/09/2020 13:45:01.658 | No connection string named 'BrokerDataServerEntities' could be found in the application config file.

 

The code is as follows:
 

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class ReportReader : Robot
    {
       
        // private StreamWriter _Writer;

        protected override void OnStart()
        {
            try
            {
                BrokerDataServerEntities db = new BrokerDataServerEntities();
                TradeRecord record = db.TradeRecords.FirstOrDefault();
                Print(record.AccountConversionPair);
            }
            catch (Exception e)
            {
                Print(e.GetBaseException().Message);
            }
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

IT would appear that no config file is being created when I publish the App

has anyone been able to get a DB connection via EntityFramework?

 

 

 


@beedge72