public static List <T> GetEntityList <T>(this IDataBaseConnector connector, string tableName, int mount = -1, int skip = 0) where T : class, IFreeDocument { var type = typeof(T); if (type.IsInterface) { type = typeof(FreeDocument); } var items = connector.GetEntities(tableName, type, mount, skip).Select(d => d as T).ToList(); return(items); }
public async Task <List <IFreeDocument> > GetDataFromDB(IDataBaseConnector db, string dataName, bool isNewData, int mount = -1) { if (db == null) { return(null); } var table = db.RefreshTableNames().FirstOrDefault(d => d.Name == dataName); var dataAll = new List <IFreeDocument>(); var task = TemporaryTask.AddTempTask(dataName + "数据导入", db.GetEntities(dataName, mount), dataAll.Add, null, table != null?table.Size:-1, notifyInterval: 1000); processManager.CurrentProcessTasks.Add(task); await Task.Run( () => task.Wait()); return(dataAll); }
public async Task<List<IFreeDocument>> GetDataFromDB(IDataBaseConnector db, string dataName, bool isNewData, int mount = -1) { if (db == null) { return null; } var table = db.RefreshTableNames().FirstOrDefault(d => d.Name == dataName); var dataAll = new List<IFreeDocument>(); var task = TemporaryTask.AddTempTask(dataName + "数据导入", db.GetEntities(dataName, typeof (FreeDocument), mount), dataAll.Add,null,table!=null?table.Size:-1,notifyInterval:1000); processManager.CurrentProcessTasks.Add(task); await Task.Run( () => task.Wait()); return dataAll; }