Пример #1
0
        /// <summary>
        ///     Imports the entity
        /// </summary>
        /// <param name="tenantId"></param>
        /// <param name="importSource"></param>
        /// <param name="settings"></param>
        /// <param name="context"></param>
        internal IEnumerable <Guid> ImportEntity(long tenantId, IDataSource importSource, EntityXmlImportSettings settings, IProcessingContext context)
        {
            IList <Guid> rootGuids = GetRootGuidsFromMetadata(importSource, context);

            using (IDataSource baseline = GetBaselineSourceForImport(tenantId, rootGuids))
                using (TenantMergeTarget target = new TenantMergeTarget
                {
                    TenantId = tenantId,
                    IgnoreExternalReferences = true
                })
                {
                    /////
                    // Copy the data
                    /////
                    using (var processor = new MergeProcessor(context)
                    {
                        OldVersion = baseline,
                        NewVersion = importSource,
                        Target = target
                    })
                    {
                        processor.MergeData( );

                        CheckForMissingDependencies(context, settings);

                        target.Commit( );
                    }
                }

            CacheManager.ClearCaches(tenantId);

            return(rootGuids);
        }