protected IMetadataItem GetMetadataItemFromFile(string filePath)
        {
            string fileDirectory = Path.GetDirectoryName(filePath);
            string fileName      = Path.GetFileName(filePath);

            // replace the original root folder with the one where the desired file is located
            ISettingsProvider settings       = this._dataProviderServices.GetSettingsProvider(LocalFileProviderName);
            string            originalFolder = settings.GetSetting(LocalFileProviderRootFolder, string.Empty);

            settings.SetSetting(LocalFileProviderRootFolder, fileDirectory);

            // get the metadata of the desired file
            IDataSourceMetadata localRoot = this._metadataLayerService.GetDataSourceMetadata(new ServerLocation(new DataSource {
                Id = DataSourceId, Provider = LocalFileProviderName
            }));
            IList <IMetadataItem> children = this._metadataLayerService.GetContentMetadata(localRoot);
            IMetadataItem         item     = children.FirstOrDefault(c => c.DisplayName == fileName);

            // restore the original root folder
            settings.SetSetting(LocalFileProviderRootFolder, originalFolder);

            return(item);
        }
Example #2
0
 public MetaObject(IDataSourceMetadata source)
 {
     this.source = source;
 }
Example #3
0
 public TablesMetaObject(IDataSourceMetadata source) : base(source)
 {
     this.mappable = false;
     this._type    = "tables";
     this._value   = "tables";
 }
Example #4
0
 public ViewMetaObject(IDataSourceMetadata source) : base(source)
 {
     this._type = "view";
 }
Example #5
0
 public TableMetaObject(IDataSourceMetadata source) : base(source)
 {
     this._type = "table";
 }
 public DatabaseMetaObject(IDataSourceMetadata source) : base(source)
 {
     this._type = "database";
 }
Example #7
0
 public SchemasMetaObject(IDataSourceMetadata source) : base(source)
 {
     this.mappable = false;
     this._type    = "schemas";
     this._value   = "schemas";
 }
Example #8
0
 public ColumnsMetaObject(IDataSourceMetadata source) : base(source)
 {
     this.mappable = false;
     this._type    = "columns";
     this._value   = "columns";
 }
 public AbstractDatabaseMetaObject(IDataSourceMetadata source) : base(source)
 {
 }
 public CatalogMetaObject(IDataSourceMetadata source) : base(source)
 {
     this._type = "catalog";
 }
Example #11
0
 public ColumnMetaObject(IDataSourceMetadata source) : base(source)
 {
     this._type = "column";
 }
Example #12
0
 public SchemaMetaObject(IDataSourceMetadata source) : base(source)
 {
     this._type = "schema";
 }