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


C# IDbConnectionFactory.Run方法代码示例

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


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

示例1: 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

示例2: 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

示例3: DeleteAllRowsFromTables

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

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

示例4: InitTests

        public void InitTests()
        {
            dbFactory = new OrmLiteConnectionFactory(":memory:", false, SqliteOrmLiteDialectProvider.Instance);
            dbFactory.Run(db => db.CreateTable<Priority>());

            var users = new InMemoryAuthRepository();

            personRepository = new PersonRepository(users, null);
            ;
        }
开发者ID:TheFailBoat,项目名称:IssueTracker,代码行数:10,代码来源:PriorityRepositoryTest.cs

示例5: InitTests

        public void InitTests()
        {
            dbFactory = new OrmLiteConnectionFactory(":memory:", false, SqliteOrmLiteDialectProvider.Instance);
            dbFactory.Run(db => db.CreateTable<Comment>());

            var users = new InMemoryAuthRepository();

            personRepository = new PersonRepository(users, null);
            issueRepository = new IssueRepository(dbFactory, personRepository);

            // TODO add issues
        }
开发者ID:TheFailBoat,项目名称:IssueTracker,代码行数:12,代码来源:CommentRepositoryTest.cs


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