• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDatabaseProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDatabaseProvider的典型用法代码示例。如果您正苦于以下问题:C# IDatabaseProvider类的具体用法?C# IDatabaseProvider怎么用?C# IDatabaseProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDatabaseProvider类属于命名空间,在下文中一共展示了IDatabaseProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
			}
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:31,代码来源:BloggerPersistenceHelper.cs


示例2: DatabaseConnectionDetector

 public DatabaseConnectionDetector(
     IConnectionStringSettings connectionStringSettings,
     IDatabaseProvider databaseProvider)
 {
     this.connectionStringSettings = connectionStringSettings;
     this.databaseProvider = databaseProvider;
 }
开发者ID:noopman,项目名称:FunnelWeb,代码行数:7,代码来源:DatabaseConnectionDetector.cs


示例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;
 }
开发者ID:noopman,项目名称:FunnelWeb,代码行数:9,代码来源:InstallController.cs


示例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;
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:25,代码来源:CMetaobjectLink.cs


示例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;
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:28,代码来源:CMetaobjectAttributeValue.cs


示例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;
 }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:7,代码来源:CMediaResource.cs


示例7: CMetaobjectExtented

        public CMetaobjectExtented(decimal Key, IDatabaseProvider Provider)
            : base(Key, Provider)
        {
            this._likesNumberAttribute.Attributes = this._attributes;

            this.LikesNumber = 0;
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:7,代码来源:CMetaobjectExtented.cs


示例8: CRdsAttribute

        public CRdsAttribute(int Key, IDatabaseProvider Provider)
            : base()
        {
            this._key = Key;
            this.AttributeGetByKey(Provider);

        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:7,代码来源:CRdsAttribute.cs


示例9: viewModel_SaveCompleted

 private void viewModel_SaveCompleted(IDatabaseProvider config)
 {
     if (this.SaveCompleted != null)
     {
         this.SaveCompleted(config);
     }
 }
开发者ID:jasenkin,项目名称:Jasen.Framework,代码行数:7,代码来源:SettingWindow.xaml.cs


示例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);
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:26,代码来源:CRdsAttributeLink.cs


示例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));
        }
开发者ID:neozhu,项目名称:MrCMS,代码行数:30,代码来源:InstallationService.cs


示例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;
        }        
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:30,代码来源:CSystemPolicy.cs


示例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;
         }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:27,代码来源:CSystemUserSession.cs


示例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;
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:27,代码来源:CMenuServiceOrderAmount.cs


示例15: DropAndCreate

		public static void DropAndCreate(IDatabaseProvider provider)
		{
			provider.DeleteAll<Shipper>();
			provider.DropAndCreate(typeof(Shipper));

			provider.DeleteAll<ShipperType>();
			provider.DropAndCreate(typeof(ShipperType));
		}
开发者ID:jwelgemoed,项目名称:SingletonTheory.Services,代码行数:8,代码来源:DataProvider.cs


示例16: GetDashboardNavigationQuery

 public GetDashboardNavigationQuery(IDatabaseProvider connection, 
     IGetDashboardNavigationSectionItemRolesQuery getDashboardNavigationSectionItemRolesQuery, 
     IGetDashboardNavigationSectionRolesQuery getDashboardNavigationSectionRolesQuery)
 {
     _connection = connection;
     _getDashboardNavigationSectionItemRolesQuery = getDashboardNavigationSectionItemRolesQuery;
     _getDashboardNavigationSectionRolesQuery = getDashboardNavigationSectionRolesQuery;
 }
开发者ID:mattapayne,项目名称:ColorSoft,代码行数:8,代码来源:GetDashboardNavigationQuery.cs


示例17: COrganizationNetwork

        public COrganizationNetwork(decimal Key, IDatabaseProvider Provider) 
            : base(Key, Provider)
        {
            this._urlAttribute.Attributes = this._attributes;
            this._mailAttribute.Attributes = this._attributes;

            this._class = EnMetaobjectClass.EOrganizationNetwork;
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:8,代码来源:COrganizationNetwork.cs


示例18: CCategory

        public CCategory(IDatabaseProvider Provider)
            : base(Provider)
        {            
            this._thumbnailAttribute.Attributes = this._attributes;

            this._thumbnailAttribute.DefaultValue = new byte[0];
            this._class = EnMetaobjectClass.ECategory;
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:8,代码来源:CCategory.cs


示例19: MigrationInitializer

 public MigrationInitializer(IConfiguration configuration, IDatabaseProvider databaseProvider, ISchemaProvider schemaProvider, ICommonTransformations commonTransformations, IConnectionProvider connectionProvider)
 {
   _configuration = configuration;
   _commonTransformations = commonTransformations;
   _databaseProvider = databaseProvider;
   _schemaProvider = schemaProvider;
   _connectionProvider = connectionProvider;
 }
开发者ID:Odyl,项目名称:machine.migrations,代码行数:8,代码来源:MigrationInitializer.cs


示例20: ObjectDeleteByKey

        public override int ObjectDeleteByKey(IDatabaseProvider Provider)
        {
            var R = CMetaobjectSecurityRecord.sDeleteRecordsByMetaobject(this._key, Provider);
            if (R != CErrors.ERR_SUC)
                return CErrors.ERR_DB_DELETE_OBJECT;

            return base.ObjectDeleteByKey(Provider);
        }
开发者ID:cMenu,项目名称:cMenu.Server,代码行数:8,代码来源:CSecuredMetaobject.cs



注:本文中的IDatabaseProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDatabaseUnitOfWork类代码示例发布时间:2022-05-24
下一篇:
C# IDatabaseFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap