forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseFixture.cs
42 lines (36 loc) · 1.04 KB
/
BaseFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections;
using NHibernate.Hql.Ast.ANTLR;
using System.Collections.Generic;
using NHibernate.Util;
namespace NHibernate.Test.BulkManipulation
{
public class BaseFixture: TestCase
{
private readonly IDictionary<string, IFilter> emptyfilters = CollectionHelper.EmptyDictionary<string, IFilter>();
#region Overrides of TestCase
protected override string[] Mappings
{
get { return Array.Empty<string>(); }
}
#endregion
protected override void Configure(Cfg.Configuration configuration)
{
var assembly = GetType().Assembly;
string mappingNamespace = GetType().Namespace;
foreach (var resource in assembly.GetManifestResourceNames())
{
if (resource.StartsWith(mappingNamespace) && resource.EndsWith(".hbm.xml"))
{
configuration.AddResource(resource, assembly);
}
}
}
public string GetSql(string query)
{
var qt = new QueryTranslatorImpl(null, new HqlParseEngine(query, false, Sfi).Parse(), emptyfilters, Sfi);
qt.Compile(null, false);
return qt.SQLString;
}
}
}