public static EAQuery Diagrams(this DbConnection connection) { EAQuery query = new EAQuery(); query.Connection = connection; query.Select = SELECT_DIAGRAMS; return query; }
private static int PackageIdByPathRecursive(DbConnection connection, IEnumerable<string> packagePath, int parentId) { int packageId = 0; var firstPackageSegment = packagePath.FirstOrDefault(); EAQuery query = new EAQuery(); query.Connection = connection; query.Select = SELECT_PACKAGES; DataSet dataSet = query.OnPackageName(firstPackageSegment) .And() .OnEqualsGeneric("t_package.Parent_ID", parentId) .QueryDataSet(); if(packagePath.Count() == 1) { if(dataSet.Tables[0].Rows.Count > 0) { return dataSet.Tables[0].Rows[0].Field<int>(0); } else { return 0; } } var reminder = packagePath.Skip(1); foreach(var row in dataSet.Tables[0].AsEnumerable()) { int subParentId = row.Field<int>(0); int tempPackageId = PackageIdByPathRecursive(connection, reminder, subParentId); if(tempPackageId > 0) { packageId = tempPackageId; break; } } return packageId; }
public static EAQuery Packages(this DbConnection connection) { EAQuery query = new EAQuery(); query.Connection = connection; query.Select = SELECT_PACKAGES; return query; }
private static DbDataAdapter GetDbDataAdapter(EAQuery query) { DbDataAdapter adapter = null; if(query.Connection.GetType() == typeof(OleDbConnection)) { OleDbCommand command = new OleDbCommand(query.Query, query.Connection as OleDbConnection); adapter = new OleDbDataAdapter(command); } else { if(query.Connection.GetType() == typeof(SqlConnection)) { SqlCommand command = new SqlCommand(query.Query, query.Connection as SqlConnection); adapter = new SqlDataAdapter(command); } } return adapter; }
public static EAQuery OperationsOfClass(this DbConnection connection) { EAQuery query = new EAQuery(); query.Connection = connection; query.Select = SELECT_INNER_JOIN_OPERATIONS_OF_OBJECT; return query; }