Beispiel #1
0
        protected virtual IMapper SpreadOptions()
        {
            ConnectionModel = ConnectionRepository.GetById(EntityModel.DestinationConnectionId.ToString());
            var connectionOptions     = ConnectionRepository.LoadOptions(ConnectionModel.Id.ToString());
            var connectionOptionItems = connectionOptions.Select(c => new OptionItem {
                Name = c.Key, Value = c.Value
            });

            Adapter.SetOptions(connectionOptionItems);
            Provider.SetOptions(connectionOptionItems);
            return(this);
        }
Beispiel #2
0
        protected virtual IIndexer SpreadOptions()
        {
            ConnectionModel = ConnectionRepository.GetById(GetIndexModel().SourceConnectionId.ToString());
            var connectionOptions     = ConnectionRepository.LoadOptions(ConnectionModel.Id.ToString());
            var connectionOptionItems = connectionOptions.Select(c => new OptionItem {
                Name = c.Key, Value = c.Value
            });

            Adapter.SetOptions(connectionOptionItems);
            Provider.SetOptions(connectionOptionItems);
            return(this);
        }
Beispiel #3
0
        virtual IPusher SpreadOptions()
        {
            var indexModel = GetIndexModel();

            ConnectionModel = ConnectionRepository.GetById(indexModel.DestinationConnectionId.ToString());
            var connectionOptions     = ConnectionRepository.LoadOptions(ConnectionModel.Id.ToString());
            var connectionOptionItems = connectionOptions.Select(c => new OptionItem {
                Name = c.Key, Value = c.Value
            });

            Adapter.SetOptions(connectionOptionItems);
            Provider.SetOptions(connectionOptionItems);
            return(this);
        }
        public IActionResult GetAll()
        {
            var connections = _connectionRepository.GetAll <ConnectionModel>();
            var options     = _connectionRepository.LoadOptions(connections.Select(c => c.Id.ToString()));

            return(Ok(connections.Select(c =>
            {
                var jConnection = JObject.FromObject(c, serializer);
                var provider = _providers.FirstOrDefault(p => p.Id == c.ProviderId);
                var cOptions = options.Where(o => o.EntityId == c.Id.ToString() && o.EntityType == EntityType.Connection);
                var optionItems = new List <OptionItem>();
                foreach (var po in provider.Options)
                {
                    var o = cOptions.FirstOrDefault(oo => oo.Key == po.Name);
                    if (o != null)
                    {
                        po.Value = o.Value;
                    }
                    optionItems.Add(po);
                }
                jConnection.Add("options", JArray.FromObject(optionItems, serializer));
                return jConnection;
            })));
        }