public class IBatisHelper
{
#region
private static object obj = new object();
protected static IDataMapper dataMapper = null;
public static ISessionFactory sessionFactory = null;
protected static ISessionStore sessionStore = null;
protected ConfigurationSetting configurationSetting;
#endregion
#region IBatisHelperInstance IBatisHelper
/// <summary>
/// IBatisHelper
/// </summary>
public static IDataMapper IBatisHelperInstance
{
get
{
if (dataMapper == null)
{
lock (obj)
{
try
{
if (dataMapper == null)
{
String ORACLE_MAPPER = "SqlMap.config";
IConfigurationEngine engine = new DefaultConfigurationEngine();
engine.RegisterInterpreter(new XmlConfigurationInterpreter(ORACLE_MAPPER));
//engine.RegisterModule(new AliasModule());
IMapperFactory mapperFactory = engine.BuildMapperFactory();
sessionFactory = engine.ModelStore.SessionFactory;
dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper;
sessionStore = ((IModelStoreAccessor)dataMapper).ModelStore.SessionStore;
}
}
catch (Exception ex)
{
Exception e = ex;
while (e != null)
{
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
e = e.InnerException;
}
throw;
}
}
}
return dataMapper;
}
}
#endregion
private IBatisHelper()
{
}
}
}