本文整理汇总了C#中IDatabaseProvider类的典型用法代码示例。如果您正苦于以下问题:C# IDatabaseProvider类的具体用法?C# IDatabaseProvider怎么用?C# IDatabaseProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDatabaseProvider类属于命名空间,在下文中一共展示了IDatabaseProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Check
public static void Check(Func<BloggerUnitOfWork> createUnitOfWork, IDatabaseProvider databaseProvider = null)
{
const string KnownEmail = "[email protected]";
const string KnownTitle = "New post";
if (databaseProvider != null)
{
databaseProvider.DropIfExists();
}
using (var unitOfWork = createUnitOfWork())
{
unitOfWork.BlogRepository.Save(BlogFactory.Create(KnownEmail));
unitOfWork.Commit();
}
using (var unitOfWork = createUnitOfWork())
{
var blog = unitOfWork.BlogRepository.GetByOwner(KnownEmail);
blog.AddPost(KnownTitle, DateTime.Now);
unitOfWork.BlogRepository.Save(blog);
unitOfWork.Commit();
}
using (var unitOfWork = createUnitOfWork())
{
var blog = unitOfWork.BlogRepository.GetByOwner(KnownEmail);
blog.Posts.Single()
.Title.Should().Be.EqualTo(KnownTitle);
}
}
示例2: DatabaseConnectionDetector
public DatabaseConnectionDetector(
IConnectionStringSettings connectionStringSettings,
IDatabaseProvider databaseProvider)
{
this.connectionStringSettings = connectionStringSettings;
this.databaseProvider = databaseProvider;
}
示例3: InstallController
// ReSharper restore UnusedAutoPropertyAccessor.Global
//public InstallController(Func<IProviderInfo<IDatabaseProvider>> databaseProvidersInfo)
public InstallController(IDatabaseProvider databaseProvider, Func<IProviderInfo<IDatabaseProvider>> databaseProvidersInfo, ISettingsProvider settingsProvider, IFederatedAuthenticationService federatedAuthenticationService)
{
this.databaseProvider = databaseProvider;
this.databaseProvidersInfo = databaseProvidersInfo;
this.settingsProvider = settingsProvider;
this.federatedAuthenticationService = federatedAuthenticationService;
}
示例4: LinkGet
public int LinkGet(IDatabaseProvider Provider)
{
Hashtable Params = new Hashtable();
Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, this._sourceObjectKey);
Params.Add(CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY, this._linkedObjectKey);
string SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_VALUE;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_TYPE;
SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_LINKS + " WHERE ";
SQL += CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY + " AND ";
SQL += CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
var T = Provider.QueryGetData(SQL, false, Params);
if (T == null || T.Rows.Count == 0)
return CErrors.ERR_DB_GET_OBJECT;
this._sourceObjectKey = T.Rows[0][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
this._linkedObjectKey = T.Rows[0][1].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
this._linkValue = T.Rows[0][2].PostProcessDatabaseValue<int>(-1);
this._linkType = T.Rows[0][3].PostProcessDatabaseValue<EnMetaobjectLinkType>();
return CErrors.ERR_SUC;
}
示例5: ValueGet
public int ValueGet(IDatabaseProvider Provider)
{
Hashtable Params = new Hashtable();
Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, this._objectKey);
Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID, this._attributeID);
var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_ATTR;
SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
SQL += " AND " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID;
var T = Provider.QueryGetData(SQL, false, Params);
if (T == null || T.Rows.Count == 0)
return CErrors.ERR_DB_GET_OBJECT;
this._values.Clear();
for (int i = 0; i < T.Rows.Count; i++)
{
byte[] Data = T.Rows[i][3].PostProcessDatabaseValue<byte[]>(new byte[0]);
var Stream = Data.ToDataStream();
var Obj = Stream.DeserializeBinaryStream<object>();
this._values.Add(T.Rows[i][2].PostProcessDatabaseValue<int>(-1), Obj);
}
return CErrors.ERR_SUC;
}
示例6: CMediaResource
public CMediaResource(decimal Key, IDatabaseProvider Provider)
: base(Key, Provider)
{
this._typeAttribute.Attributes = this._attributes;
this._mediaAttribute.Attributes = this._attributes;
this._linkAttribute.Attributes = this._attributes;
}
示例7: CMetaobjectExtented
public CMetaobjectExtented(decimal Key, IDatabaseProvider Provider)
: base(Key, Provider)
{
this._likesNumberAttribute.Attributes = this._attributes;
this.LikesNumber = 0;
}
示例8: CRdsAttribute
public CRdsAttribute(int Key, IDatabaseProvider Provider)
: base()
{
this._key = Key;
this.AttributeGetByKey(Provider);
}
示例9: viewModel_SaveCompleted
private void viewModel_SaveCompleted(IDatabaseProvider config)
{
if (this.SaveCompleted != null)
{
this.SaveCompleted(config);
}
}
示例10: LinkInsert
public int LinkInsert(IDatabaseProvider Provider)
{
Hashtable Params = new Hashtable();
Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY, this._key);
Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID, this._id.ToString().ToUpper());
Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME, this._name);
Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY, this._attributeKey);
Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY, this._linkedAttributeKey);
var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_RDS_LINKS;
SQL += " (" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY + ")";
SQL += " VALUES ";
SQL += " (@p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY;
SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;
SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME;
SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY;
SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY + ")";
var T = Provider.QueryExecute(SQL, false, Params);
return (T ? -1 : -2);
}
示例11: SetUpInitialData
private void SetUpInitialData(InstallModel model, IDatabaseProvider provider)
{
var configurator = new NHibernateConfigurator(provider);
ISessionFactory sessionFactory = configurator.CreateSessionFactory();
ISession session = sessionFactory.OpenFilteredSession(CurrentRequestData.CurrentContext);
IStatelessSession statelessSession = sessionFactory.OpenStatelessSession();
var kernel = MrCMSApplication.Get<IKernel>();
kernel.Rebind<ISession>().ToMethod(context => session);
kernel.Rebind<IStatelessSession>().ToMethod(context => statelessSession);
var site = new Site
{
Name = model.SiteName,
BaseUrl = model.SiteUrl,
CreatedOn = DateTime.UtcNow,
UpdatedOn = DateTime.UtcNow
};
using (ITransaction transaction = statelessSession.BeginTransaction())
{
statelessSession.Insert(site);
transaction.Commit();
}
CurrentRequestData.CurrentSite = site;
kernel.Get<IInitializeDatabase>().Initialize(model);
kernel.Get<ICreateInitialUser>().Create(model);
kernel.GetAll<IOnInstallation>()
.OrderBy(installation => installation.Priority)
.ForEach(installation => installation.Install(model));
}
示例12: sGetAllPolicies
public List<CSystemPolicy> sGetAllPolicies(IDatabaseProvider Provider)
{
List<CSystemPolicy> R = new List<CSystemPolicy>();
Hashtable Params = new Hashtable();
Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_CLASS, EnMetaobjectClass.ESystemUser);
var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ID + ", ";
SQL += CDBConst.CONST_TABLE_FIELD_OBJ_PARENT + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_SYSTEM + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_MOD + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_STATUS;
SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS + " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS;
var T = Provider.QueryGetData(SQL, false, Params);
if (T == null)
return R;
for (int i = 0; i < T.Rows.Count; i++)
{
var Policy = new CSystemPolicy(Provider);
Policy.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
Policy.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
Policy.Parent = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
Policy.Class = T.Rows[i][3].PostProcessDatabaseValue<EnMetaobjectClass>();
Policy.System = ((T.Rows[i][4]).PostProcessDatabaseValue<int>() == 1);
Policy.ModificatonDate = T.Rows[0][5].PostProcessDatabaseValue<DateTime>();
Policy.Status = T.Rows[0][6].PostProcessDatabaseValue<EnMetaobjectStatus>();
Policy.Attributes.ObjectKey = Policy.Key;
R.Add(Policy);
}
return R;
}
示例13: SessionGetByKey
public int SessionGetByKey(decimal Key, IDatabaseProvider Provider)
{
Hashtable Params = new Hashtable();
Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_KEY, Key);
var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_SESSION_USER + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_DEADLINE;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_ID + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_STATUS + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_VARIABLES;
SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_TYPE;
SQL += " FROM " + CDBConst.CONST_TABLE_SESSION;
SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_SESSION_KEY;
var T = Provider.QueryGetData(SQL, false, Params);
if (T == null || T.Rows.Count == 0)
return CErrors.ERR_DB_GET_OBJECT;
this._userKey = T.Rows[0][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
this._deadLine = T.Rows[0][2].PostProcessDatabaseValue<DateTime>(DateTime.Now);
this._key = T.Rows[0][3].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
this._id = Guid.Parse(T.Rows[0][4].PostProcessDatabaseValue<string>(""));
this._status = T.Rows[0][5].PostProcessDatabaseValue<EnSessionStatus>(EnSessionStatus.EEnabled);
this._type = T.Rows[0][7].PostProcessDatabaseValue<EnSessionType>(EnSessionType.EWeb);
byte[] Data = T.Rows[0][6].PostProcessDatabaseValue<byte[]>(new byte[0]);
this._variables = Data.ToDataStream().DeserializeBinaryStream<Hashtable>();
return CErrors.ERR_SUC;
}
示例14: sGetAmountsByOrder
public static List<CMenuServiceOrderAmount> sGetAmountsByOrder(decimal Key, IDatabaseProvider Provider)
{
List<CMenuServiceOrderAmount> R = new List<CMenuServiceOrderAmount>();
Hashtable Params = new Hashtable();
Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY, Key);
var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT;
SQL += " FROM " + CDBConst.CONST_TABLE_ORDERS_AMOUNTS;
SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY;
var T = Provider.QueryGetData(SQL, false, Params);
if (T == null || T.Rows.Count == 0)
return R;
for (int i = 0; i < T.Rows.Count; i++)
{
var Amount = new CMenuServiceOrderAmount();
Amount.OrderKey = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
Amount.AmountKey = T.Rows[i][1].PostProcessDatabaseValue<decimal>();
Amount.Amount = T.Rows[i][2].PostProcessDatabaseValue<int>();
R.Add(Amount);
}
return R;
}
示例15: DropAndCreate
public static void DropAndCreate(IDatabaseProvider provider)
{
provider.DeleteAll<Shipper>();
provider.DropAndCreate(typeof(Shipper));
provider.DeleteAll<ShipperType>();
provider.DropAndCreate(typeof(ShipperType));
}