question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

runtime error after changing default table prefix

See original GitHub issue

I follow the guide to change default prefix, all works fine before I run the web host project. when I start the project, got an error: Invalid object name 'Editions." I found someone has the same issue too: https://gist.github.com/hikalkan/4f8f793c7929a81d300f int the last comment

  • Your Abp package version: 4.3.0
  • Your base framework: .Net Core.
  • Exception message and stack trace if available:

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\n at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\n at System.Data.SqlClient.SqlDataReader.get_MetaData()\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\n at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)\n at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)\n at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary2 parameterValues)\n at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues)\n at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)\n at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded)\n at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.MoveNext()\n at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Boolean& found)\n at lambda_method(Closure )\n at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ResultEnumerable1.GetEnumerator()\n at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider._TrackEntities[TOut,TIn](IEnumerable1 results, QueryContext queryContext, IList1 entityTrackingInfos, IList1 entityAccessors)+MoveNext()\n at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.MoveNext()\n at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Boolean& found)\n at System.Linq.Enumerable.First[TSource](IEnumerable1 source)\n at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass15_11.<CompileQueryCore>b__0(QueryContext qc)\n at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable1 source, Expression1 predicate)\n at NewiNOC.EntityFrameworkCore.Seed.Host.DefaultEditionCreator.CreateEditions() in /Volumes/project/aspnet-core/src/NewiNOC.EntityFrameworkCore/EntityFrameworkCore/Seed/Host/DefaultEditionCreator.cs:line 25\n

  • Steps needed to reproduce the problem.
  1. add following code to dbcontext protected override void OnModelCreating(ModelBuilder modelBuilder) { //use Noc as default prefix for default tables base.OnModelCreating(modelBuilder); modelBuilder.ChangeAbpTablePrefix<Tenant, Role, User>(“Noc”); }
  2. dotnet ef migrations add chagne_table_names
  3. drop database and use migrator create whole new database
  4. run the web host project

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
evenleecommented, Jul 26, 2019

Thanks, I’ve removed all my migrations, and re-migrated the whole database, after the operation, the error disappeared.

0reactions
ismcagdascommented, Jul 25, 2019

Could you share your project if you are still having this problem ? If not, could you share reproduction steps ? Everything seems normal in your case.

By the way, are you sure that your app is using the correct database ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Change DB Prefix" wordpress plugin error/issue
Findings - I logged into phpMyAdmin from cPanel and found that all tables have old prefix, which means none of the tables are...
Read more >
Change the table prefix for WordPress
In this guide, we explain how to change the database table prefix of your WordPress installation. The default database table prefix for WordPress...
Read more >
Error when removing table prefix in v10.0 #9889
I successfully executed update-database to create the initial tables. When I went to change the table prefix with the line above, I received...
Read more >
KB16779: Database instance table prefix is not used in the ...
The database instance table prefix is only used when jobs such as report execution and element requests are run for projects associated with ......
Read more >
Error after I changed the plugin prefix table
I have installed and configured your plugin and successfully I have connected your plugin to Analytics, Adsense, etc. But recently, I changed my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found