当前位置: 首页>>代码示例>>C#>>正文


C# IDbProvider类代码示例

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


IDbProvider类属于命名空间,在下文中一共展示了IDbProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TwitterModule

        public TwitterModule(IDbProvider dbProvider)
        {
            Get["/{slug}"] = p =>
                {
                    var mvp = dbProvider.GetDb()
                        .mvps.FindAllBySlug(p["slug"])
                        .WithLinks()
                        .FirstOrDefault()
                        ;

                    if (mvp == null)
                    {
                        return HttpStatusCode.NotFound;
                    }

                    TwitterJson model = TwitterJson.ParseSingle(mvp);

                    return Response.AsJson(model);
                };

            Get["/"] = _ =>
                {
                    var mvps = dbProvider.GetDb().mvps.WithLinks();

                    TwitterJson model = TwitterJson.ParseList(mvps);

                    return Response.AsJson(model);
                };
        }
开发者ID:KoprowskiT,项目名称:msmvppl,代码行数:29,代码来源:TwitterModule.cs

示例2: PagedQueryBuilder

 public PagedQueryBuilder(TableInfo info,IDbProvider provider)
 {
    
     _info = info;
     _provider = provider;
 
 }
开发者ID:sapiens,项目名称:SqlFu,代码行数:7,代码来源:PagedQueryBuilder.cs

示例3: ConnectionString

		public IDbContext ConnectionString(string connectionString, IDbProvider fluentDataProvider, string providerName = null)
		{
			if(string.IsNullOrEmpty(providerName))
				providerName = fluentDataProvider.ProviderName;
			var adoNetProvider = System.Data.Common.DbProviderFactories.GetFactory(providerName);
			return ConnectionString(connectionString, fluentDataProvider, adoNetProvider);
		}
开发者ID:wanlitao,项目名称:FCP.FluentData,代码行数:7,代码来源:ConnectionStrings.cs

示例4: DatabaseSchema

        /// <summary>
        /// Initializes a new instance of a DatabaseSchema.
        /// </summary>
        /// <param name="dbprovider"></param>
        public DatabaseSchema(IDbProvider dbprovider)
        {
            if (dbprovider == null)
                throw new ArgumentNullException("dbprovider");

            _dbprovider = dbprovider;
        }
开发者ID:chrcar01,项目名称:SchemaProber,代码行数:11,代码来源:DatabaseSchema.cs

示例5: SetUpMocks

        public void SetUpMocks()
        {
            provider = MockRepository.GenerateMock<IDbProvider>();
            IDbConnection connection = MockRepository.GenerateMock<IDbConnection>();

            provider.Stub(x => x.CreateConnection()).Return(connection).Repeat.Once();

            // Creating a query (setting DbProvider property)
            // will call new DbParameters(IDbProvider), which is a real pain to mock.
            // to store the declared parameters.

            command = MockRepository.GenerateMock<IDbCommand>();
            //This IDbCommand is used as a container for the underlying parameter collection.	
            provider.Stub(x => x.CreateCommand()).Return(command).Repeat.Once();

            //Create a real instance of IDbParameters to stored the declared parameters
            IDbProvider realDbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
            IDbParameters dbParameters = new DbParameters(realDbProvider);

            //Pass real instance into mock instance.
            command.Stub(x => x.Parameters).Return(dbParameters.DataParameterCollection).Repeat.Once();
            provider.Stub(x => x.CreateCommand()).Return(command).Repeat.Once();

            // done with init of DbParameters mock/stubbing
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:25,代码来源:AbstractAdoQueryTests.cs

示例6: GenerateSql

		public string GenerateSql(IDbProvider provider, string parameterPrefix, BuilderData data)
		{
			var setSql = "";
			foreach (var column in data.Columns)
			{
				if (setSql.Length > 0)
					setSql += ", ";

				setSql += string.Format("{0} = {1}{2}",
									provider.EscapeColumnName(column.ColumnName),
									parameterPrefix,
									column.ParameterName);
			}

			var whereSql = "";
			foreach (var column in data.Where)
			{
				if (whereSql.Length > 0)
					whereSql += " and ";

				whereSql += string.Format("{0} = {1}{2}",
									provider.EscapeColumnName(column.ColumnName),
									parameterPrefix,
									column.ParameterName);
			}

			var sql = string.Format("update {0} set {1} where {2}",
										data.ObjectName,
										setSql,
										whereSql);
			return sql;
		}
开发者ID:wanlitao,项目名称:FCP.FluentData,代码行数:32,代码来源:UpdateBuilderSqlGenerator.cs

示例7: Serialize

 /// <summary>
 /// Serializes the specified <see cref="IDbProvider"/> into an <see cred="IConfiguration" /> node.
 /// </summary>
 public static IConfiguration Serialize(IDbProvider dbProvider)
 {
     IConfiguration providerConfig = new MutableConfiguration("provider", dbProvider.Id, dbProvider.Id);
     providerConfig.Attributes[DataConstants.ATTRIBUTE_NAME] = dbProvider.Id;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_ASSEMBLYNAME] = dbProvider.AssemblyName;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_COMMANDBUILDERCLASS] = dbProvider.CommandBuilderClass;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_COMMANDCLASS] = dbProvider.DbCommandClass;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_CONNECTIONCLASS] = dbProvider.DbConnectionClass;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_DESCRIPTION] = dbProvider.Description;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_DEFAULT] = dbProvider.IsDefault.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_ENABLED] = dbProvider.IsEnabled.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_PARAMETERDBTYPECLASS] = dbProvider.ParameterDbTypeClass;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_PARAMETERDBTYPEPROPERTY] = dbProvider.ParameterDbTypeProperty;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_PARAMETERPREFIX] = dbProvider.ParameterPrefix;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_PARAMETERPREFIX] = dbProvider.ParameterPrefix;
     providerConfig.Attributes[DataConstants.ATTRIBUTE_SETDBPARAMETERPRECISION] = dbProvider.SetDbParameterPrecision.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_SETDBPARAMETERSCALE] = dbProvider.SetDbParameterScale.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_SETDBPARAMETERSIZE] = dbProvider.SetDbParameterSize.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_USEDERIVEPARAMETERS] = dbProvider.UseDeriveParameters.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_USEPARAMETERPREFIXINPARAMETER] = dbProvider.UseParameterPrefixInParameter.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_USEPARAMETERPREFIXINSQL] = dbProvider.UseParameterPrefixInSql.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_USEPOSITIONALPARAMETERS] = dbProvider.UsePositionalParameters.ToString().ToLower();
     providerConfig.Attributes[DataConstants.ATTRIBUTE_ALLOWMARS] = dbProvider.AllowMARS.ToString().ToLower();
     return providerConfig;
 }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:28,代码来源:ProviderSerializer.cs

示例8: DBSemaphore

 /// <summary>
 /// Initializes a new instance of the <see cref="DBSemaphore"/> class.
 /// </summary>
 /// <param name="tablePrefix">The table prefix.</param>
 /// <param name="sql">The SQL.</param>
 /// <param name="defaultSQL">The default SQL.</param>
 /// <param name="dbProvider">The db provider.</param>
 public DBSemaphore(string tablePrefix, string sql, string defaultSQL, IDbProvider dbProvider) {
     log = LogManager.GetLogger(GetType());
     this.sql = defaultSQL;
     this.tablePrefix = tablePrefix;
     SQL = sql;
     adoUtil = new AdoUtil(dbProvider);
 }
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:14,代码来源:DBSemaphore.cs

示例9: IDbCommandCreatorFactory

		/// <summary>
		/// Initializes a new instance of the <see cref="IDbCommandCreatorFactory"/> class.
        /// </summary>
	    public IDbCommandCreatorFactory(IDbProvider dbProvider, CommandType commandType, string sql, IDbParameters declaredParameters)
	    {
            this.dbProvider = dbProvider;
            this.sql = sql;	
		    this.commandType = commandType;
		    this.declaredParameters = declaredParameters;
	    }
开发者ID:Binodesk,项目名称:spring-net,代码行数:10,代码来源:IDbCommandCreatorFactory.cs

示例10: AddParam

 public static DbParameter AddParam(this DbCommand cmd, IDbProvider provider, string name, object value)
 {
     var p = cmd.CreateParameter();
     provider.SetupParameter(p,name,value);
     cmd.Parameters.Add(p);
     return p;
 }
开发者ID:sapiens,项目名称:SqlFu,代码行数:7,代码来源:PrepareStatement.cs

示例11: SqlFuConnection

 public SqlFuConnection(DbConnection cnx,IDbProvider provider)
 {
     cnx.MustNotBeNull();
     provider.MustNotBeNull();
     _conex = cnx;
     _provider = provider;
   
 }
开发者ID:sapiens,项目名称:SqlFu,代码行数:8,代码来源:SqlFuConnection.cs

示例12: Inject

 public void Inject(IDbProvider dbProvider, IReadWriteLockManager lockManager)
 {
     Debug.Assert(dbProvider != null && lockManager != null);
     if (this.dbProvider != null || this.lockManager != null)
         throw new InvalidOperationException();
     this.dbProvider = dbProvider;
     this.lockManager = lockManager;
 }
开发者ID:afrancocode,项目名称:PessimisticOfflineReadWriteLock,代码行数:8,代码来源:ApplicationManager.cs

示例13: SetUp

 public void SetUp()
 {
     ctx =
         new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/autoDeclarativeServices.xml");
     dbProvider = ctx["DbProvider"] as IDbProvider;
     transactionManager = ctx["adoTransactionManager"] as IPlatformTransactionManager;
     
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:8,代码来源:AutoDeclarativeTxTests.cs

示例14: CreateDbProvider

 public void CreateDbProvider()
 {
     IApplicationContext ctx =
         new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/adoTemplateTests.xml");
     Assert.IsNotNull(ctx);
     dbProvider = ctx["DbProvider"] as IDbProvider;
     Assert.IsNotNull(dbProvider);
 }
开发者ID:fuadm,项目名称:spring-net,代码行数:8,代码来源:MappingAdoQueryTests.cs

示例15: InsertSqlBuilder

 public InsertSqlBuilder(TableInfo info,object data,IDbProvider provider,InsertSqlOptions options)
 {
     _info = info;
     _data = data;
     _provider = provider;
     _options = options;      
     options.EnsureTableName(info);      
 }
开发者ID:sapiens,项目名称:SqlFu,代码行数:8,代码来源:InsertSqlBuilder.cs


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