Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
MessageStore' is an ambiguous reference between 'FIX.MessageStore' and 'QuickFix.MessageStore'

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Windows;
using System.Windows.Input;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.IO;
using QuickFix;
using SystemDataType = System.ComponentModel.DataAnnotations.DataType;

namespace FIX
{
internal class Connection : ConnectionBase<messagestore>
{
private SslTunnel _sslTunnel;
public Session Session { get; private set; }

public void Create(int senderSeqNum, int targetSeqNum)
{
Create();

Session = Session.lookupSession(SessionID);
Session.setNextSenderMsgSeqNum(senderSeqNum);
Session.setNextTargetMsgSeqNum(targetSeqNum);

var ssl = (bool)Program.Props[Prop.SSL].Value;
_sslTunnel = ssl ? new SslTunnel(Program.Props[Prop.Host].Value.ToString(), (int)Program.Props[Prop.Port].Value) : null;
}

public override void Open(string username, string password)
{
if (_sslTunnel != null)
_sslTunnel.Open();
base.Open(username, password);
}

protected override SessionSettings GetSessionSettings()
{
var stream = new MemoryStream(1024);
var writer = new StreamWriter(stream);

var ssl = (bool)Program.Props[Prop.SSL].Value;

writer.WriteLine("[DEFAULT]");
writer.WriteLine("ConnectionType={0}", "initiator");
writer.WriteLine("HeartBtInt={0}", Program.Props[Prop.HeartbeatInterval].Value);
if (ssl)
{
writer.WriteLine("SocketConnectHost=localhost");
writer.WriteLine("SocketConnectPort={0}", SslTunnel.LocalPort);
}
else
{
writer.WriteLine("SocketConnectHost={0}", Program.Props[Prop.Host].Value);
writer.WriteLine("SocketConnectPort={0}", Program.Props[Prop.Port].Value);
}
writer.WriteLine("ReconnectInterval={0}", Program.Props[Prop.ReconnectInterval].Value);
writer.WriteLine("UseDataDictionary={0}", 'N');
writer.WriteLine("MillisecondsInTimestamp={0}", (bool)Program.Props[Prop.MillisecondsInTimestamp].Value ? 'Y' : 'N');

writer.WriteLine("[SESSION]");
writer.WriteLine("BeginString={0}", Program.Props[Prop.BeginString].Value);
writer.WriteLine("SenderCompID={0}", Program.Props[Prop.SenderCompID].Value);
writer.WriteLine("TargetCompID={0}", Program.Props[Prop.TargetCompID].Value);

writer.WriteLine("StartTime={0}", Tools.LocalToUtc((TimeSpan)Program.Props[Prop.SessionStart].Value));
writer.WriteLine("EndTime={0}", Tools.LocalToUtc((TimeSpan)Program.Props[Prop.SessionEnd].Value));

writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
return new SessionSettings(stream);
}
}
}

What I have tried:

I try to rebuild in lower Frame 4.5 , 3.5 do not work

David
Posted
Updated 3-Apr-17 15:20pm
v4
Comments
[no name] 3-Apr-17 18:34pm    
"ambiguous reference", sure, make the reference unambiguous.
Graeme_Grant 3-Apr-17 21:22pm    
Something funky is happening with the editor ... have reported the bug.
Wessel Beulink 4-Apr-17 4:38am    
I think Your ConnectionBase<messagestore> already have a Create() function. What if you also override Create() ?

1 solution

Read the error again. It's telling you that there is something defined as 'MessageStore' in the namespace QuickFix and you have something in your FIX called "MessageStore'. The compiler can't tell which one you want to use so you have to tell it by prefixing your use of 'MessageStore' with the namespace of the one you want, just like in the error message.
 
Share this answer
 
Comments
Dave Kreskowiak 4-Apr-17 12:09pm    
Actually, the compiler is very smart, but it can't read your mind. It's telling you EXACTLY what the problem with the code is.

The problem isn't with the computer or the compiler, it's with the person writing the code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900