Esempio n. 1
0
        public override DataDictionary GetDictionary()
        {
            try
            {
                DataDictionary dataDictionary = new DataDictionary()
                {
                    dataObjects = new List <DataObject>()
                };

                foreach (SpreadsheetTable table in _provider.GetConfiguration().Tables)
                {
                    DataObject dataObject = new DataObject()
                    {
                        objectName     = table.Label,
                        tableName      = table.Name,
                        dataProperties = new List <DataProperty>()
                    };

                    dataDictionary.dataObjects.Add(dataObject);

                    foreach (SpreadsheetColumn column in table.Columns)
                    {
                        DataProperty dataProperty = new DataProperty()
                        {
                            propertyName = column.Label,
                            columnName   = column.Name,
                            dataType     = column.DataType,
                            dataLength   = column.DataLength
                        };

                        if (table.Identifier.Equals(column.Label))
                        {
                            dataObject.addKeyProperty(dataProperty);
                        }
                        else
                        {
                            dataObject.dataProperties.Add(dataProperty);
                        }
                    }
                }

                return(dataDictionary);
            }
            catch (Exception e)
            {
                throw new Exception("Error while creating dictionary.", e);
            }
            finally
            {
                _provider.Dispose();
            }
        }