I have just started on a new project, where the database is built using code first.
I have attempted to run the project for the first time and get the below Exception. I have checked that
using (var serviceScope = serviceProvider.CreateScope())
{
var db = serviceScope.ServiceProvider.GetService<ILoggingDbContext>();
await db.Database.MigrateAsync();
}
1. No database changes have been made to the Dev Database.
2. Check that other Dev's on the team don't have the same problem.
I have tried to google the exception message, but each result talks about the database changes that I am trying to make.
Can anyone give me a pointer on things to do next?
System.Data.SqlClient.SqlException
HResult=0x80131904
Message=Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.
Source=Core .Net SqlClient Data Provider
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__17.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.<ExecuteNonQueryAsync>d__8.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.<ExecuteNonQueryAsync>d__1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<MigrateAsync>d__12.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at FFO.Data.Helpers.Startup.LoggingEfStartup.<InitializeDatabaseAsync>d__0.MoveNext() in C:\Users\simon_whale\Source\Repos\fleet fine online\FleetFineOnline\FFO-Data\Helpers\Startup\LoggingEFStartup.cs:line 17
What I have tried:
A lot of Google Fo on the following Exception
SqlException: Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.
Checking with other Developers
Reinstalling the Branch for the project.