コード例 #1
0
        public void Initialize()
        {
            var tableName = _tableNameHelper.GetTableName();

            var databaseContext      = UmbracoContext.Current.Application.DatabaseContext;
            var databaseSchemaHelper = new DatabaseSchemaHelper(databaseContext.Database, LoggerResolver.Current.Logger, databaseContext.SqlSyntax);

            if (!databaseSchemaHelper.TableExist(tableName))
            {
                databaseSchemaHelper.CreateTable <NodeReport>(false);
            }
        }
コード例 #2
0
        public void GetTableName_OnExecute_IsCorreclyResolvedWhenTableNameAttributeIsSet()
        {
            var testDatabaseObjectRepository = new TableNameHelper <TestDatabaseObject>();
            var result = testDatabaseObjectRepository.GetTableName();

            Assert.AreEqual("Test", result);
        }
コード例 #3
0
        public void GetTableName_OnExecute_ThrowsExceptionWhenNotSet()
        {
            var testDatabaseObjectRepository = new TableNameHelper <TestDatabaseObjectWithoutTableName>();

            testDatabaseObjectRepository.GetTableName();
        }