public void Copy(IUriExtent source, IUriExtent target)
 {
     var copier = new ObjectCopier(_factory);
     foreach (var element in source.elements())
     {
         var elementAsElement = element as IElement;
         var copiedElement = copier.Copy(elementAsElement);
         target.elements().add(copiedElement);
     }
 }
        /// <summary>
        ///     Loads the document from an XDocument
        /// </summary>
        /// <param name="extent">Extent to which the data is loaded</param>
        /// <param name="document">Document to be loaded</param>
        public void Load(IUriExtent extent, XDocument document)
        {
            _idToElement.Clear();

            // Skip the first element
            foreach (var element in document.Elements().Elements())
            {
                extent.elements().add(LoadElement(element));
            }
        }
        /// <summary>
        ///     Creates a C# class instance for all the packages and classes within the extent
        /// </summary>
        /// <param name="extent">Extent to be used</param>
        public virtual void Walk(IUriExtent extent)
        {
            var stack = new CallStack(null);

            StartNamespace(ref stack);
            foreach (var element in extent.elements())
            {
                var elementAsObject = element as IObject;
                Walk(elementAsObject, stack);
            }

            EndNamespace(ref stack);
        }
        /// <summary>
        /// Saves the extent into database.
        /// </summary>
        /// <param name="extent">Extent to be stored</param>
        /// <param name="path">Path, where file shall be stored</param>
        /// <param name="settings">Settings being used</param>
        public void Save(IUriExtent extent, string path, CSVSettings settings)
        {
            var columns = new List<string>();

            // Retrieve the column headers
            if (settings.HasHeader && settings.Columns.Any())
            {
                // Column headers given by old extent
                columns.AddRange(settings.Columns);
            }
            else
            {
                // Column headers given by number by asking each object about the number of properties and
                // then use the maximum value of the elements. This assumes that every element has the same type
                columns = extent.GetProperties().ToList();
            }

            // Open File
            using (var streamWriter = new StreamWriter(File.OpenWrite(path), Encoding.GetEncoding(settings.Encoding)))
            {
                // Writes the header
                if (settings.HasHeader)
                {
                    WriteRow(streamWriter, settings, columns, x => x.ToString());
                }

                // Writes the elements
                foreach (var element in extent.elements().Select(x => x as IObject))
                {
                    WriteRow(
                        streamWriter,
                        settings,
                        columns,
                        x => element.isSet(x) ? element.get(x) : string.Empty);
                }
            }
        }
 public ColumnCreationResult FindColumnsForTable(IUriExtent extent)
 {
     return FindColumnsForTable(extent.elements());
 }