| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 26 | 2 | 3 | 0.990 | class_member_declaration |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 26 | 148 | src/NHibernate.Test/SecondLevelCacheTest/SecondLevelCacheTest.cs |
| 2 | 26 | 177 | src/NHibernate.Test/SecondLevelCacheTest/SecondLevelCacheTest.cs |
| ||||
[Test]
public void SecondLevelCacheWithCriteriaQueries()
{
using (ISession session = OpenSession())
{
IList list = session.CreateCriteria( typeof(AnotherItem)).
Add (Expression.Gt("Id", 2)).
SetCacheable(true).
List();
Assert.AreEqual(3, list.Count);
using (IDbCommand cmd = session.Connection.CreateCommand())
{
cmd.CommandText = "DELETE FROM AnotherItem";
cmd.ExecuteNonQuery();
}
}
using (ISession session = OpenSession())
{
//should bring from cache
IList list = session.CreateCriteria( typeof(AnotherItem)).
Add (Expression.Gt("Id", 2)).
SetCacheable(true).
List();
Assert.AreEqual(3, list.Count);
}
}
|
| ||||
[Test]
public void SecondLevelCacheWithCriteriaQueriesForItemWithCollections()
{
using (ISession session = OpenSession())
{
IList list = session.CreateCriteria( typeof(Item)).
Add (Expression.Gt("Id", 2)).
SetCacheable(true).
List();
Assert.AreEqual(3, list.Count);
using (IDbCommand cmd = session.Connection.CreateCommand())
{
cmd.CommandText = "DELETE FROM Item";
cmd.ExecuteNonQuery();
}
}
using (ISession session = OpenSession())
{
//should bring from cache
IList list = session.CreateCriteria( typeof(Item)).
Add (Expression.Gt("Id", 2)).
SetCacheable(true).
List();
Assert.AreEqual(3, list.Count);
}
}
|
| |||
[Test]
public void [[#variable6e716100]]()
{
using (ISession session = OpenSession())
{
IList list = session.CreateCriteria( typeof( [[#variable2a583140]])).Add(Expression.Gt("Id", 2)).SetCacheable(true).List();
Assert.AreEqual(3, list.Count);
using (IDbCommand cmd = session.Connection.CreateCommand())
{
cmd.CommandText = [[#variable6e716060]];
cmd.ExecuteNonQuery();
}
}
using (ISession session = OpenSession())
{
//should bring from cache
IList list = session.CreateCriteria( typeof( [[#variable2a583140]])).Add(Expression.Gt("Id", 2)).SetCacheable(true).List();
Assert.AreEqual(3, list.Count);
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#6e716100]] | SecondLevelCacheWithCriteriaQueries |
| 1 | 2 | [[#6e716100]] | SecondLevelCacheWithCriteriaQueriesForItemWithCollections |
| 2 | 1 | [[#2a583140]] | AnotherItem |
| 2 | 2 | [[#2a583140]] | Item |
| 3 | 1 | [[#6e716060]] | "DELETE FROM AnotherItem" |
| 3 | 2 | [[#6e716060]] | "DELETE FROM Item" |