public void LoadTables()
        {
            if (ProviderName.IsNullOrWhiteSpace() || ConnectionString.IsNullOrWhiteSpace())
            {
                throw new Exception($"数据库{Name}配置ProviderName/ConnectionString错误");
            }

            var service = GetDatabaseService(ConnectionString);

            var filterTables = FilterTables.IsNullOrEmpty() ? new List <string>() : FilterTables.Split(new char[] { ',', ',' }).ToList();
            var baseFields   = BaseFields.IsNullOrEmpty() ? new List <string>() : BaseFields.Split(new char[] { ',', ',' }).ToList();
            var tables       = service.GetTableModels(filterTables, baseFields);

            Tables.AddRange(tables);
        }
예제 #2
0
 void ParseFilter()
 {
     // parse tables to collect
     if (!string.IsNullOrEmpty(FilterTablesIgnore))
     {
         string[] sFilter = FilterTablesIgnore.Split(';');
         FilterTableIgnoreList = new List <string>(sFilter);
     }
     else
     {
         FilterTableIgnoreList = new List <string>();
     }
     // parse tables to ignore
     if (!string.IsNullOrEmpty(FilterTables))
     {
         string[] sFilter = FilterTables.Split(';');
         FilterTableList = new List <string>(sFilter);
     }
     else
     {
         FilterTableList = new List <string>();
     }
     // parse request to collect
     if (!string.IsNullOrEmpty(FilterRequestType))
     {
         string[] sFilter = FilterRequestType.Split(';');
         FilterRequestTypeList = new List <string>(sFilter);
     }
     else
     {
         FilterRequestTypeList = new List <string>();
     }
     // parse request to collect
     if (!string.IsNullOrEmpty(FilterRequestTypeIgnore))
     {
         string[] sFilter = FilterRequestTypeIgnore.Split(';');
         FilterRequestTypeIgnoreList = new List <string>(sFilter);
     }
     else
     {
         FilterRequestTypeIgnoreList = new List <string>();
     }
 }
예제 #3
0
파일: DataLayer.cs 프로젝트: bobdeus/PTT
 private static string GetMediaInnerJoin(FilterTables tables)
 {
     string innerJoin = "";
     if (tables.HasFlag(FilterTables.Inventory))
         innerJoin += "inner join Inventory on Media.MediaId = Inventory.MediaId ";
     if (tables.HasFlag(FilterTables.MediaMetadata))
         innerJoin += "inner join MediaMetadata on Media.MediaId = MediaMetadata.MediaId ";
     return innerJoin;
 }
예제 #4
0
파일: Filter.cs 프로젝트: bobdeus/PTT
 internal ColumnFilter(FilterTables tables, string whereFilter)
 {
     this.tables = tables;
     this.whereFilter = whereFilter;
 }
예제 #5
0
파일: Filter.cs 프로젝트: bobdeus/PTT
 /// <summary>
 /// Creates a filter with an upper and lower bound (one or both can be null to unbound that range)
 /// </summary>
 /// <param name="upperBound">finds things &lt; this value</param>
 /// <param name="lowerBound">finds things >= this value</param>
 public RangeFilter(FilterTables tables, string column, string lowerBound, string upperBound)
 {
     this.tables = tables;
     this.column = column;
     this.upperBound = upperBound;
     this.lowerBound = lowerBound;
 }