示例#1
0
        /// <summary>
        /// Check if this batchinfo has some data (in memory or not)
        /// </summary>
        public bool HasData(string tableName, string schemaName)
        {
            if (this.SanitizedSchema == null)
            {
                throw new NullReferenceException("Batch info schema should not be null");
            }

            if (InMemory && InMemoryData != null && InMemoryData.HasTables)
            {
                var table = InMemoryData.Tables[tableName, schemaName];
                if (table == null)
                {
                    return(false);
                }

                return(table.HasRows);
            }

            if (!InMemory && BatchPartsInfo != null && BatchPartsInfo.Count > 0)
            {
                var tableInfo = new BatchPartTableInfo(tableName, schemaName);

                var bptis = BatchPartsInfo.SelectMany(bpi => bpi.Tables.Where(t => t.EqualsByName(tableInfo)));

                if (bptis == null)
                {
                    return(false);
                }


                return(bptis.Sum(bpti => bpti.RowsCount) > 0);
            }

            return(false);
        }