예제 #1
0
        public static EAQuery Diagrams(this DbConnection connection)
        {
            EAQuery query = new EAQuery();
            query.Connection = connection;
            query.Select = SELECT_DIAGRAMS;

            return query;
        }
예제 #2
0
        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;
        }
예제 #3
0
        public static EAQuery Packages(this DbConnection connection)
        {
            EAQuery query = new EAQuery();
            query.Connection = connection;
            query.Select = SELECT_PACKAGES;

            return query;
        }
예제 #4
0
        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;
        }
예제 #5
0
        public static EAQuery OperationsOfClass(this DbConnection connection)
        {
            EAQuery query = new EAQuery();
            query.Connection = connection;
            query.Select = SELECT_INNER_JOIN_OPERATIONS_OF_OBJECT;

            return query;
        }