protected IList<Model> Load(Queryset queryset = null) { if (queryset != null) queryset.Compile(); IList<DbValue[]> rows = DbEngine.Select(ModelInfo, queryset); if (rows != null && rows.Count > 0) { List<Model> models = new List<Model>(); foreach (DbValue[] row in rows) { Model model = OrmManager.CreateNewModel(ModelInfo.ModelApp, ModelInfo.ModelType); if (model != null) { foreach (DbValue dbValue in row) { Field field = model.GetFieldByDbName(dbValue.Column); if (field != null) model[field.Name] = field.FromDbValue(dbValue.Value); } model.Status = ModelStatus.Loaded; models.Add(model); } } return models; } return null; }
public IList ToList(string fieldName, Queryset queryset = null) { if (queryset != null) queryset.Compile(); return DbEngine.ToList(ModelInfo, fieldName, queryset); }
public bool Delete(Queryset queryset) { if (queryset != null) queryset.Compile(); return DbEngine.Delete(ModelInfo, queryset); }
public DataTable ToDataTable(string[] fieldNames, Queryset queryset = null) { if (queryset != null) queryset.Compile(); return DbEngine.ToDataTable(ModelInfo, fieldNames, queryset); }
public long Count(Queryset queryset = null) { if (queryset != null) queryset.Compile(); return DbEngine.SelectCount(ModelInfo, queryset); }