I think we need to move GetDataCacheHitRatio from MappedStatement into CachingStatement and make this change to GetDataCacheStats:
IDictionaryEnumerator enumerator = _mappedStatements.GetEnumerator(); while (enumerator.MoveNext()) { IMappedStatement statement = (IMappedStatement)enumerator.Value; if (statement is CachingStatement) { // snip } else { buffer.Append("No Cache."); } buffer.Append(Environment.NewLine); } I'll run a test on that code this weekend. --- "David Marzo (Puzzlet)" <[EMAIL PROTECTED]> wrote: > IBatisNet.DataMapper.SqlMapper > > public string GetDataCacheStats() > { > StringBuilder buffer = new StringBuilder("\nCache Data > Statistiques"); > buffer.Append("\n=======================\n"); > IDictionaryEnumerator enumerator = > _mappedStatements.GetEnumerator(); > while (enumerator.MoveNext()) > { > MappedStatement statement = (MappedStatement) > enumerator.Value; > buffer.Append(statement.Name); > buffer.Append(": "); > double hitRatio = > statement.GetDataCacheHitRatio(); > if (hitRatio != -1) > { > > buffer.Append(Math.Round(hitRatio * 100)); > buffer.Append("%"); > } > else > { > buffer.Append("No Cache."); > } > buffer.Append("\n"); > } > return buffer.ToString(); > } > } > > InvalidCastException at ln 1340. > > MappedStatement statement = (MappedStatement) enumerator.Value; > > I debug and surprising the statement cached is an object of > CachingStatement that no inherits from MappedStatement.