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


C# IDbConnectionFactory类代码示例

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


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

示例1: RepositoryProxy

 public RepositoryProxy(IDbConnectionFactory dbConnectionFactory, IRedisClientsManager redisClientsManager)
 {
     DbConnectionFactory= dbConnectionFactory;
     RedisClientsManager= redisClientsManager;
     CreateCommand();
     CreateRedisClient();
 }
开发者ID:angelcolmenares,项目名称:Calamar,代码行数:7,代码来源:RepositoryProxy.cs

示例2: DbRepository

        protected DbRepository(IDbConnectionFactory dbConnectionFactory)
        {
            if(dbConnectionFactory == null)
                throw new ArgumentNullException("dbConnectionFactory");

            this._dbConnectionFactory = dbConnectionFactory;
        }
开发者ID:sridhar19091986,项目名称:simpleot,代码行数:7,代码来源:DbRepository.cs

示例3: RecreateTables

        private void RecreateTables(IDbConnectionFactory factory)
        {
            factory.Run(x =>
            {
                using (var transaction = x.BeginTransaction())
                {
                    try
                    {
                        //core tables
                        x.DropAndCreateTables(typeof(VCALENDAR), typeof(VEVENT), typeof(VTODO), typeof(VFREEBUSY), typeof(FREEBUSY), typeof(VJOURNAL), typeof(VTIMEZONE), typeof(STANDARD), typeof(DAYLIGHT), typeof(AUDIO_ALARM), typeof(DISPLAY_ALARM), typeof(EMAIL_ALARM), typeof(ORGANIZER), typeof(ATTENDEE), typeof(COMMENT), typeof(RELATEDTO), typeof(ATTACH_BINARY), typeof(ATTACH_URI), typeof(CONTACT), typeof(RDATE), typeof(EXDATE), typeof(RECUR), typeof(RECURRENCE_ID), typeof(REQUEST_STATUS), typeof(RESOURCES), typeof(TZNAME));

                        //3NF relational tables
                        x.DropAndCreateTables(typeof(REL_CALENDARS_EVENTS), typeof(REL_CALENDARS_TODOS), typeof(REL_CALENDARS_FREEBUSIES), typeof(REL_CALENDARS_JOURNALS), typeof(REL_CALENDARS_TIMEZONES),  typeof(REL_EVENTS_ATTACHBINS), typeof(REL_EVENTS_ATTACHURIS), typeof(REL_EVENTS_ATTENDEES), typeof(REL_EVENTS_AUDIO_ALARMS), typeof(REL_EVENTS_COMMENTS), typeof(REL_EVENTS_CONTACTS), typeof(REL_EVENTS_DISPLAY_ALARMS), typeof(REL_EVENTS_EMAIL_ALARMS), typeof(REL_EVENTS_EXDATES), typeof(REL_EVENTS_RDATES), typeof(REL_EVENTS_RELATEDTOS), typeof(REL_EVENTS_REQSTATS), typeof(REL_EVENTS_RESOURCES), typeof(REL_TODOS_ATTACHBINS), typeof(REL_TODOS_ATTACHURIS), typeof(REL_TODOS_ATTENDEES), typeof(REL_TODOS_AUDIO_ALARMS), typeof(REL_TODOS_COMMENTS), typeof(REL_TODOS_CONTACTS), typeof(REL_TODOS_DISPLAY_ALARMS), typeof(REL_TODOS_EMAIL_ALARMS), typeof(REL_TODOS_EXDATES), typeof(REL_TODOS_RDATES), typeof(REL_TODOS_RELATEDTOS), typeof(REL_TODOS_REQSTATS), typeof(REL_TODOS_RESOURCES), typeof(REL_FREEBUSIES_ATTACHBINS), typeof(REL_FREEBUSIES_ATTACHURIS), typeof(REL_FREEBUSIES_ATTENDEES), typeof(REL_FREEBUSIES_COMMENTS), typeof(REL_FREEBUSIES_REQSTATS), typeof(REL_FREEBUSIES_VFREEBUSIES), typeof(REL_JOURNALS_ATTACHBINS), typeof(REL_JOURNALS_ATTACHURIS), typeof(REL_JOURNALS_ATTENDEES), typeof(REL_JOURNALS_COMMENTS), typeof(REL_JOURNALS_CONTACTS), typeof(REL_JOURNALS_EXDATES), typeof(REL_JOURNALS_RDATES), typeof(REL_JOURNALS_RELATEDTOS), typeof(REL_JOURNALS_REQSTATS), typeof(REL_JOURNALS_RESOURCES), typeof(REL_EALARMS_ATTACHBINS), typeof(REL_EALARMS_ATTACHURIS), typeof(REL_EALARMS_ATTENDEES), typeof(REL_TIMEZONES_STANDARDS), typeof(REL_TIMEZONES_DAYLIGHT), typeof(REL_STANDARDS_COMMENTS), typeof(REL_STANDARDS_RDATES), typeof(REL_STANDARDS_TZNAMES), typeof(REL_DAYLIGHTS_COMMENTS), typeof(REL_DAYLIGHTS_RDATES), typeof(REL_DAYLIGHTS_TZNAMES));

                        transaction.Commit();
                    }
                    catch (ApplicationException)
                    {
                        transaction.Rollback();
                        throw;
                    }
                    catch (InvalidOperationException)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            });
        }
开发者ID:reexjungle,项目名称:xcal,代码行数:29,代码来源:admin.ormlite.repository.cs

示例4: SqlContextTransactionManager

 public SqlContextTransactionManager(IDbConnectionFactory connectionFactory, IContextTransactionLifetimeManager contextTransactionLifetimeManager, ILoggerFactory loggerFactory)
 {
     _connectionFactory = connectionFactory;
     _contextTransactionLifetimeManager = contextTransactionLifetimeManager;
     _loggerFactory = loggerFactory;
     _logger = loggerFactory.Create("EventSourcing.SqlContextTransactionManager");
 }
开发者ID:tangxuehua,项目名称:eventsourcing,代码行数:7,代码来源:SqlContextTransactionManager.cs

示例5: CreateSqliteInMemoryTables

        private void CreateSqliteInMemoryTables(IDbConnectionFactory dbFactory)
        {
            try
            {
                using (IDbConnection db = dbFactory.OpenDbConnection())
                {
                    db.CreateTable<Todo>(true);
                    db.CreateTable<Account>(false);
                    db.CreateTable<Service>(false);
                    db.CreateTable<Tag>(false);
                    db.CreateTable<Content>(false);
                    db.CreateTable<ContentTag>(false);

                    Guid accountId = Guid.NewGuid();
                    Guid serviceId = Guid.NewGuid();

                    db.Insert<Todo>(new Todo { Id = Guid.NewGuid(), Content = "bla", Done = false, Order = 1 });
                    db.Insert<Account>(new Account { Id = accountId, FullName = "Metaintellect" });
                    db.Insert<Service>(new Service { Id = serviceId, Name = "content" });
                    db.Insert<Content>(new Content { Id = Guid.NewGuid(), Title = "New Title", CreatedAt = DateTime.Now, AccountId = accountId, ServiceId = serviceId });
                    db.Insert<Tag>(GetTags(accountId).ToArray());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                throw;
            }
        }
开发者ID:qualtrak,项目名称:servicestack-test,代码行数:29,代码来源:AppHost.cs

示例6: CreateManager

        public static IBlogManager CreateManager(IBlogRepository repository = null,
            IDbConnectionFactory connectionFactory = null)
        {
            if (repository == null)
                repository = new BlogRepository();

            if (connectionFactory == null && repository.DbFactory == null)
            {
                if (ConfigurationManager.ConnectionStrings["BlogDB"] == null)
                {
                    connectionFactory =
                        new OrmLiteConnectionFactory(
                            ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString,
                            SqlServerOrmLiteDialectProvider.Instance);
                    repository.DbFactory = connectionFactory;
                }
                else
                {
                    connectionFactory =
                        new OrmLiteConnectionFactory(
                            ConfigurationManager.ConnectionStrings["BlogDB"].ConnectionString,
                            SqlServerOrmLiteDialectProvider.Instance);

                    repository.DbFactory = connectionFactory;
                }
            }

            return new BlogManager
            {
                BlogRepo = repository
            };
        }
开发者ID:Kgrohs,项目名称:JustBlogging,代码行数:32,代码来源:BlogManagerFactory.cs

示例7: CreateManager

        public static LogViewerManager CreateManager(ILogViewerRepository repository = null, IDbConnectionFactory connectionFactory = null, string connectionStringMapping = null)
        {
            if (repository == null)
                repository = new LogViewerRepository();

            if (connectionStringMapping == null)
                connectionStringMapping = "LoggingConnection1";

            if (connectionFactory == null && repository.DbFactory == null)
            {
                if (ConfigurationManager.ConnectionStrings[connectionStringMapping] == null)
                {
                    connectionFactory =
                        new OrmLiteConnectionFactory(
                            ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString,
                            SqlServerOrmLiteDialectProvider.Instance);
                    repository.DbFactory = connectionFactory;
                }
                else
                {
                    connectionFactory =
                        new OrmLiteConnectionFactory(
                            ConfigurationManager.ConnectionStrings[connectionStringMapping].ConnectionString,
                            SqlServerOrmLiteDialectProvider.Instance);

                    repository.DbFactory = connectionFactory;
                }
            }

            return new LogViewerManager
            {
                LogViewerRepo = repository
            };
        }
开发者ID:Kgrohs,项目名称:Azure-Lumberjack,代码行数:34,代码来源:LogViewerManagerFactory.cs

示例8: Bootstrapper

        public Bootstrapper(IDbConnectionFactory connectionFactory)
        {
            _connectionFactory = connectionFactory;

            StaticConfiguration.DisableErrorTraces = false;
            StaticConfiguration.EnableRequestTracing = true;

            //Cross origin resource sharing
            ApplicationPipelines.AfterRequest.AddItemToEndOfPipeline(x => x.Response.WithHeader("Access-Control-Allow-Origin", "*"));
            ApplicationPipelines.AfterRequest.AddItemToEndOfPipeline(x => x.Response.WithHeader("Access-Control-Allow-Methods", "DELETE, GET, HEAD, POST, PUT, OPTIONS, PATCH"));
            ApplicationPipelines.AfterRequest.AddItemToEndOfPipeline(x => x.Response.WithHeader("Access-Control-Allow-Headers", "Content-Type"));
            ApplicationPipelines.AfterRequest.AddItemToEndOfPipeline(x => x.Response.WithHeader("Accept", "application/json"));

            //Default format to JSON (very low priority)
            ApplicationPipelines.BeforeRequest.AddItemToStartOfPipeline(x => {
                x.Request.Headers.Accept = x.Request.Headers.Accept.Concat(new Tuple<string, decimal>("application/json", 0.01m));
                return null;
            });

            //Make sure this is being accessed over a secure connection
            var httpsRedirect = SecurityHooks.RequiresHttps(redirect: false);
            ApplicationPipelines.BeforeRequest.AddItemToEndOfPipeline(x => {
                if (!IsSecure(x))
                    return httpsRedirect(x);
                return null;
            });
        }
开发者ID:WildGenie,项目名称:Bastet-Legacy,代码行数:27,代码来源:Bootstrapper.cs

示例9: DbAuthenticator

        public DbAuthenticator(IDbConnectionFactory factory)
        {
            if (factory == null)
                throw new ArgumentNullException ("factory");

            connFactory = factory;
        }
开发者ID:Dynalon,项目名称:Rainy,代码行数:7,代码来源:DbAuthenticator.cs

示例10: AudioAlarmOrmRepository

        /// <summary>
        ///     Initializes a new instance of the <see cref="AudioAlarmOrmRepository" /> class.
        /// </summary>
        public AudioAlarmOrmRepository(IKeyGenerator<Guid> keygenerator, IDbConnectionFactory factory)
        {
            if (keygenerator == null) throw new ArgumentNullException(nameof(keygenerator));
            if (factory == null) throw new ArgumentNullException(nameof(factory));

            this.keygenerator = keygenerator;
            DbConnectionFactory = factory;
        }
开发者ID:reexjungle,项目名称:xcal,代码行数:11,代码来源:alarm.ormlite.repositories.cs

示例11: MigrationStep

 public MigrationStep(IMigration migration, IScheduledMigrationMetadata metadata, ConnectionInfo connectionInfo, IProvider provider, IProviderMetadata providerMetadata, IDbConnectionFactory connectionFactory, ISqlDispatcher sqlDispatcher)
     : base(migration, provider, providerMetadata)
 {
     _metadata = metadata;
     _connectionInfo = connectionInfo;
     _connectionFactory = connectionFactory;
     _sqlDispatcher = sqlDispatcher;
 }
开发者ID:mediocreguy,项目名称:MigSharp,代码行数:8,代码来源:MigrationStep.cs

示例12: Seed

 public static void Seed(IDbConnectionFactory dbFactory)
 {
     dbFactory.Run(db =>
     {
         CategorySeeder.Seed(db);
         PrioritySeeder.Seed(db);
         StatusSeeder.Seed(db);
     });
 }
开发者ID:TheFailBoat,项目名称:IssueTracker,代码行数:9,代码来源:SeedingContext.cs

示例13: GetByJobCityId

		public static List<Person> GetByJobCityId(this Person request, 
		                                           IDbConnectionFactory DbFactory){
			
			
			return DbFactory.Exec(dbCmd=> dbCmd.Select<Person>
			                      (q=> q.JobCityId ==request.JobCityId)).
			                      OrderBy( q=> q.Name).ToList();
			
		}
开发者ID:angelcolmenares,项目名称:ServiceStack.AuthDemo,代码行数:9,代码来源:ModelExtensions.cs

示例14: GetByUserName

		public static List<UserAuth> GetByUserName(this UserAuth request, 
		                                           IDbConnectionFactory DbFactory){
			var un= request.UserName;
			
			return DbFactory.Exec(dbCmd=> dbCmd.Select<UserAuth>
			                      (q=> q.UserName.Contains(un))).
			                      OrderBy( q=> q.UserName).ToList();
			
		}
开发者ID:angelcolmenares,项目名称:ServiceStack.AuthDemo,代码行数:9,代码来源:ModelExtensions.cs

示例15: GetByCountryId

		public static List<City> GetByCountryId(this City request, 
		                                           IDbConnectionFactory DbFactory){
			
			
			return DbFactory.Exec(dbCmd=> dbCmd.Select<City>
			                      (q=> q.CountryId ==request.CountryId )).
			                      OrderBy( q=> q.Name).ToList();
			
		}
开发者ID:angelcolmenares,项目名称:ServiceStack.AuthDemo,代码行数:9,代码来源:ModelExtensions.cs


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