コード例 #1
0
 private IEnumerable <EntityTypeAsset> AssembleEntityTypes(
     Type externalSystem,
     EntityTypeSuite entityTypes,
     ConnectorSuite sinks,
     ConnectorSuite cacheFeeds,
     IDictionary <Type, ExternalSystemAsset> externalSystemAssetsByType)
 {
     return
         (entityTypes
          .DestinationSystemEntityTypes[externalSystem]
          .Keys
          .Select(entityType => new EntityTypeAsset(
                      entityType,
                      entityTypes
                      .DestinationSystemEntityTypes[externalSystem][entityType]
                      .Attribute,
                      new SharedIdentifierSourceSystemsProvider(
                          externalSystemAssetsByType,
                          entityTypes
                          .DestinationSystemEntityTypes[externalSystem][entityType]
                          .SharedSourceSystemIdentifiersAttributes),
                      this.GetEntityTypeSink(entityType, externalSystem, sinks),
                      this.GetEntityTypeCacheFeed(entityType, externalSystem, cacheFeeds)))
          .ToArray());
 }
コード例 #2
0
        private Type GetConnector(
            Type entityType,
            Type externalSystem,
            ConnectorSuite connectors,
            string notFoundExceptionMessageFormat = null)
        {
            Type connector;

            if (connectors.EntityTypeConnectors.ContainsKey(entityType))
            {
                connector = connectors.EntityTypeConnectors[entityType];
            }
            else if (connectors.DestinationSystemConnectors.ContainsKey(externalSystem))
            {
                connector = connectors.DestinationSystemConnectors[externalSystem];
            }
            else if (notFoundExceptionMessageFormat != null)
            {
                throw new InvalidOperationException(string.Format(
                                                        notFoundExceptionMessageFormat, entityType.FullName));
            }
            else
            {
                connector = null;
            }
            return(connector);
        }
コード例 #3
0
        private IDictionary <Type, ExternalSystemAsset> AssembleExternalSystems(
            IDictionary <Type, ExternalSystemAttribute> externalSystems,
            IDictionary <Type, SourceSystemParametersAttribute> sourceSystemParameters,
            EntityTypeSuite entityTypes,
            ConnectorSuite sinks,
            ConnectorSuite cacheFeeds)
        {
            var externalSystemAssetsByType = new Dictionary <Type, ExternalSystemAsset>();

            foreach (Type externalSystem in externalSystems.Keys)
            {
                externalSystemAssetsByType.Add(
                    externalSystem,
                    new ExternalSystemAsset(
                        externalSystem,
                        externalSystems[externalSystem],
                        this.Get(externalSystem, sourceSystemParameters),
                        this.AssembleEntityTypes(
                            externalSystem,
                            entityTypes,
                            sinks,
                            cacheFeeds,
                            externalSystemAssetsByType)));
            }
            return(externalSystemAssetsByType);
        }
コード例 #4
0
 private Type GetEntityTypeSink(
     Type entityType, Type externalSystem, ConnectorSuite sinks)
 {
     return(this.GetConnector(
                entityType,
                externalSystem,
                sinks,
                Resources.NoSinkExistsForEntityType));
 }
コード例 #5
0
        private AssetSuite AssembleAssets(
            IDictionary <Type, ExternalSystemAttribute> externalSystems,
            IDictionary <Type, SourceSystemParametersAttribute> sourceSystemParameters,
            EntityTypeSuite entityTypes,
            ConnectorSuite sinks,
            ConnectorSuite cacheFeeds,
            IEnumerable <Feed> feeds)
        {
            IDictionary <Type, ExternalSystemAsset> externalSystemAssetsByType =
                this.AssembleExternalSystems(
                    externalSystems,
                    sourceSystemParameters,
                    entityTypes,
                    sinks,
                    cacheFeeds);

            return(new AssetSuite(
                       externalSystemAssetsByType.Values,
                       this.AssembleFeeds(feeds, externalSystemAssetsByType)));
        }
コード例 #6
0
        /// <summary>
        /// Assembles the suite of assets (i.e., external systems, entity types, feeds,
        /// etc.) found in all currently loaded assemblies.
        /// </summary>
        /// <returns>The suite of assets assembled.</returns>
        public AssetSuite AssembleAssets()
        {
            AssetSuite assetSuite;
            IDictionary <Type, ExternalSystemAttribute>
            externalSystems = this.GetExternalSystems();
            IDictionary <Type, SourceSystemParametersAttribute>
            sourceSystemParameters         = this.assetExtractor.GetSourceSystemParameters();
            EntityTypeSuite    entityTypes = this.GetEntityTypes(externalSystems);
            ConnectorSuite     sinks       = this.GetSinks(externalSystems, entityTypes);
            ConnectorSuite     cacheFeeds  = this.GetCacheFeeds(externalSystems, entityTypes);
            IEnumerable <Feed> feeds       = this.GetFeeds(externalSystems, entityTypes);

            assetSuite = this.AssembleAssets(
                externalSystems,
                sourceSystemParameters,
                entityTypes,
                sinks,
                cacheFeeds,
                feeds);
            this.ValidateAssetSuite(assetSuite);
            return(assetSuite);
        }
コード例 #7
0
 private Type GetEntityTypeCacheFeed(
     Type entityType, Type externalSystem, ConnectorSuite cacheFeeds)
 {
     return(this.GetConnector(entityType, externalSystem, cacheFeeds));
 }