年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

98 lines
2.6 KiB

using System;
using System.Diagnostics;
using System.Reflection;
using KGIS.Plugin.LayerProperty.Interface;
using KGIS.Plugin.LayerProperty.Model;
namespace KGIS.Plugin.LayerProperty.Utils.Storage
{
public class RDBHelperStorage : AbstractStorage<ICoreRDBHelper>
{
private static RDBHelperStorage rdbHelperStorage;
private static IRDBFactory rdbfactory;
private AbstractStorage<ICoreRDBHelper>.Collections _collection
{
get
{
return base.Collection;
}
}
public new static AbstractStorage<ICoreRDBHelper>.Collections Collection
{
get
{
return RDBHelperStorage.rdbHelperStorage._collection;
}
}
public static ICoreRDBHelper SystemRDBHelper
{
get
{
return RDBHelperStorage.rdbHelperStorage._collection["SystemRuntime"];
}
}
public static IRDBFactory RDBFactory
{
get
{
return RDBHelperStorage.rdbfactory;
}
set
{
MethodBase method = new StackTrace().GetFrame(1).GetMethod();
string @namespace = method.DeclaringType.Namespace;
if (!@namespace.Equals("KGIS.DataAccess"))
{
throw new Exception("此方法只应用于数据访问工厂才可用");
}
RDBHelperStorage.rdbfactory = value;
}
}
static RDBHelperStorage()
{
RDBHelperStorage.rdbHelperStorage = new RDBHelperStorage();
}
private bool _add(ItemInfo<string, ICoreRDBHelper> item)
{
return base.Add(item);
}
private bool _remove(ItemInfo<string, ICoreRDBHelper> item)
{
return base.Remove(item);
}
private void _clear()
{
base.Clear();
}
public new static bool Add(ItemInfo<string, ICoreRDBHelper> item)
{
MethodBase method = new StackTrace().GetFrame(1).GetMethod();
string @namespace = method.DeclaringType.Namespace;
if (!@namespace.Equals("KGIS.DataAccess"))
{
throw new Exception("此方法只应用于数据访问工厂才可用");
}
return RDBHelperStorage.rdbHelperStorage._add(item);
}
public new static bool Remove(ItemInfo<string, ICoreRDBHelper> item)
{
MethodBase method = new StackTrace().GetFrame(1).GetMethod();
string @namespace = method.DeclaringType.Namespace;
if (!@namespace.Equals("KGIS.DataAccess"))
{
throw new Exception("此方法只应用于数据访问工厂才可用");
}
return RDBHelperStorage.rdbHelperStorage._remove(item);
}
public new static void Clear()
{
MethodBase method = new StackTrace().GetFrame(1).GetMethod();
string @namespace = method.DeclaringType.Namespace;
if (!@namespace.Equals("KGIS.DataAccess"))
{
throw new Exception("此方法只应用于数据访问工厂才可用");
}
RDBHelperStorage.rdbHelperStorage._clear();
}
}
}