예제 #1
0
            IEnumerable <Security> ISecurityProvider.Lookup(Security criteria)
            {
                if (criteria.Code == "*")
                {
                    return(_securitiesById.Values);
                }

                var security = _securitiesById.TryGetValue(criteria.Id);

                if (security != null)
                {
                    return new[] { security }
                }
                ;

                return(_securitiesByCode.TryGetValue(criteria.Code) ?? Enumerable.Empty <Security>());
            }

            object ISecurityProvider.GetNativeId(Security security)
            {
                throw new NotSupportedException();
            }

            void ISecurityStorage.Save(Security security)
            {
                _securitiesByCode.SafeAdd(security.Code).Add(security);
                _securitiesById[security.Id] = security;
            }

            IEnumerable <string> ISecurityStorage.GetSecurityIds()
            {
                return(_securitiesById.Keys);
            }