← Zurück

Ошибка при попытке сохранить ордера и сделки с помощью SettingsStorage

Нужно сохранять ордера и сделки для среднесрочной стратегии Пробую делать вот так:


            storage = new SettingsStorage();
            
            var orderDictionary = new Dictionary<Order, IEnumerable<MyTrade>>();
            foreach (var order in Orders)
            {
                orderDictionary.Add(order, order.GetTrades());
            }
            if (storage.ContainsKey("Orders"))
                storage["Orders"] = orderDictionary;
            else
                storage.Add("Orders", orderDictionary);

            var xmlSerializer = new XmlSerializer<SettingsStorage>();
            xmlSerializer.Serialize(storage, Name + "_settings.xml");

xmlSerializer.Serialize выбрасывает Exception

"Resolution of the dependency failed, type = \"Ecng.Serialization.IStorage\", name = \"(none)\".\r\n
Exception occurred while: while resolving.\r\n
Exception is: InvalidOperationException - The current type, Ecng.Serialization.IStorage, is an interface and cannot be constructed. Are you missing a type mapping?\r\n
-----------------------------------------------\r\n
At the time of the exception, the container was:\r\n
\r\n
Resolving Ecng.Serialization.IStorage,(none)\r\n"

Exeption snaphsot: http://i.imgur.com/cIwbBMA.png

Данный способ подсмотрел вот тут: http://stocksharp.com/posts/m/26336/

Подскажите, пожалуйста, как с этим справиться?

War dieses Thema hilfreich?

Thema teilen

Kommentare (0)

Anmelden oder Konto erstellen, Melden Sie sich an oder registrieren Sie sich, um einen Kommentar zu hinterlassen

Noch keine Kommentare. Seien Sie der Erste!