Click here to Skip to main content
15,567,221 members
Home / Discussions / C#
   

C#

 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois25-Nov-22 20:16
professionalKevin Marois25-Nov-22 20:16 
GeneralRe: Entity Framework Core 6 Problem Pin
Dave Kreskowiak26-Nov-22 6:20
mveDave Kreskowiak26-Nov-22 6:20 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois26-Nov-22 10:20
professionalKevin Marois26-Nov-22 10:20 
GeneralRe: Entity Framework Core 6 Problem Pin
Dave Kreskowiak26-Nov-22 10:24
mveDave Kreskowiak26-Nov-22 10:24 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois26-Nov-22 11:24
professionalKevin Marois26-Nov-22 11:24 
GeneralRe: Entity Framework Core 6 Problem Pin
Dave Kreskowiak26-Nov-22 12:31
mveDave Kreskowiak26-Nov-22 12:31 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois26-Nov-22 12:50
professionalKevin Marois26-Nov-22 12:50 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois27-Nov-22 8:56
professionalKevin Marois27-Nov-22 8:56 
OK, so I went through the Migrations Oerview and installed the necessary packages. I then ran Add Migration and Update Database. Now I get this
Applying migration '20221127185110_Initial'.
Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
IF SCHEMA_ID(N'public') IS NULL EXEC(N'CREATE SCHEMA [public];');
Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'public' in the database.
CREATE SCHEMA failed due to previous errors.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
   at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
ClientConnectionId:5f3126d9-a1c8-4a81-b0f8-8eba5fd77448
Error Number:2714,State:6,Class:16
There is already an object named 'public' in the database.
CREATE SCHEMA failed due to previous errors.

Set Rant On

This is why I have stayed with Linq-To-SQL. EF is WAAAAAY too complicated. The fact the I need to run console commands is mind-boggling. There's no UI for this? Point & click! And the amount of learning and work to set it up is astounding. And god forbid you make a mistake.

Set Rant Off

Ok, so I'm not even sure what 'public' it thinks is in the DB. It created the DB but not any tables with the exception of MigrationsHistory. So I'm now back where I started - stuck. Any idea what 'public' it's referring to?

Also, do you know of any references that can walk me through setting up & using EF Core. Assume I know nothing. I have this book. I went through the entire first chapter where he sets up the tables, relations, and DBContext, and there's no mention of Migration so far.

Thanks again.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 27-Nov-22 14:55pm.

GeneralRe: Entity Framework Core 6 Problem Pin
Dave Kreskowiak27-Nov-22 9:38
mveDave Kreskowiak27-Nov-22 9:38 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois27-Nov-22 10:16
professionalKevin Marois27-Nov-22 10:16 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois27-Nov-22 10:31
professionalKevin Marois27-Nov-22 10:31 
GeneralRe: Entity Framework Core 6 Problem Pin
Dave Kreskowiak27-Nov-22 10:32
mveDave Kreskowiak27-Nov-22 10:32 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois27-Nov-22 10:39
professionalKevin Marois27-Nov-22 10:39 
GeneralRe: Entity Framework Core 6 Problem Pin
Dave Kreskowiak26-Nov-22 12:40
mveDave Kreskowiak26-Nov-22 12:40 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois26-Nov-22 12:50
professionalKevin Marois26-Nov-22 12:50 
AnswerRe: Entity Framework Core 6 Problem Pin
Sam Hobbs24-Nov-22 12:23
Sam Hobbs24-Nov-22 12:23 
GeneralRe: Entity Framework Core 6 Problem Pin
Kevin Marois24-Nov-22 13:22
professionalKevin Marois24-Nov-22 13:22 
QuestioniTextSharp to Append QRCode to an Existing PDF File Pin
Fezih523-Nov-22 22:27
Fezih523-Nov-22 22:27 
AnswerRe: iTextSharp to Append QRCode to an Existing PDF File Pin
Richard Deeming23-Nov-22 23:00
mveRichard Deeming23-Nov-22 23:00 
QuestionTriangles count in Graph Pin
Member 1177893019-Nov-22 16:20
Member 1177893019-Nov-22 16:20 
AnswerRe: Triangles count in Graph Pin
Dave Kreskowiak19-Nov-22 19:03
mveDave Kreskowiak19-Nov-22 19:03 
AnswerRe: Triangles count in Graph Pin
OriginalGriff19-Nov-22 21:20
mvaOriginalGriff19-Nov-22 21:20 
AnswerRe: Triangles count in Graph Pin
Gerry Schmitz20-Nov-22 6:13
mveGerry Schmitz20-Nov-22 6:13 
QuestionDynamic table insert issue with dates Pin
Vijay Bhaskar Oct202217-Nov-22 7:32
Vijay Bhaskar Oct202217-Nov-22 7:32 
AnswerRe: Dynamic table insert issue with dates Pin
Slacker00717-Nov-22 7:46
professionalSlacker00717-Nov-22 7:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.