Пример #1
0
        public DataSource GetDataSourceById(Guid dataSourceId)
        {
            DataSource dataSource = DataSourceDao.FindById(dataSourceId);

            InitializeDataSource(dataSource);

            return(dataSource);
        }
Пример #2
0
        public void GetDataSourceToViewRequestMap(DataSource dataSource, View view, out PropertyMap dataSourceToViewRequestMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            DataSource readDataSource = DataSourceDao.FindById(dataSource.Id);
            View       readView       = ViewDao.FindById(view.Id);

            if (readDataSource != null &&
                readDataSource.ServiceMethod != null &&
                readDataSource.ServiceMethod.RequestMap != null)
            {
                sourceProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readDataSource.ServiceMethod.RequestMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            if (readView.ResponseMap != null)
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(readView.ResponseMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readView.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            if (readDataSource != null)
            {
                dataSourceToViewRequestMap = readDataSource.RequestMap;
                MetaManagerUtil.InitializePropertyMap(dataSourceToViewRequestMap);
            }
            else
            {
                dataSourceToViewRequestMap = null;
            }
        }
Пример #3
0
        public DataSource SaveOrUpdateDataSourceMaps(DataSource dataSource, PropertyMap requestMap, PropertyMap responseMap)
        {
            DataSource readDataSource = DataSourceDao.FindById(dataSource.Id);

            if (readDataSource != null)
            {
                if (requestMap != null)
                {
                    readDataSource.RequestMap = PropertyMapDao.SaveOrUpdateMerge(requestMap);
                }

                if (responseMap != null)
                {
                    readDataSource.ResponseMap = PropertyMapDao.SaveOrUpdateMerge(responseMap);
                }

                return(DataSourceDao.SaveOrUpdate(readDataSource));
            }
            else
            {
                return(null);
            }
        }