Keyword not supported: 'datasource' in Abp framework startup project

193 Views Asked by At

Project: Abp 7.0 MVC EF Core

I am getting the following error "System.ArgumentException: 'Keyword not supported: 'datasource'.'" with the first migration and seed of the DbMigrator project by following the guide for creating the first project at the link:https://abp.io/get-started

I also attach the screenshot of the error and my connection string.

I hope someone can help me thanks.

{
  "App": {
    "SelfUrl": "https://localhost:44333"
  },
  "ConnectionStrings": {
    "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=BookStore;Trusted_Connection=True;TrustServerCertificate=True"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "WK92PI2AFTDsZUoI"
  }
}

Error

System.ArgumentException
  HResult=0x80070057
  Messaggio=Keyword not supported: 'datasource'.
  Origine=Microsoft.Data.SqlClient
  Analisi dello stack:
   in Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey)
   in Microsoft.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)
   in Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   in Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   in Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   in Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
   in Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   in Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)
   in Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection()
   in Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()
   in Microsoft.EntityFrameworkCore.Storage.RelationalConnection.<OpenAsync>d__66.MoveNext()
   in Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass20_0.<<ExistsAsync>b__0>d.MoveNext()
   in Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass20_0.<<ExistsAsync>b__0>d.MoveNext()
   in Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__7`2.MoveNext()
   in Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.<ExistsAsync>d__24.MoveNext()
   in Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<MigrateAsync>d__15.MoveNext()
   in Acme.BookStore.EntityFrameworkCore.EntityFrameworkCoreBookStoreDbSchemaMigrator.<MigrateAsync>d__2.MoveNext() in C:\Users\GordonGekko87\source\repos\Acme.BookStore\src\Acme.BookStore.EntityFrameworkCore\EntityFrameworkCore\EntityFrameworkCoreBookStoreDbSchemaMigrator.cs: riga 29
   in Acme.BookStore.Data.BookStoreDbMigrationService.<MigrateDatabaseSchemaAsync>d__10.MoveNext() in C:\Users\GordonGekko87\source\repos\Acme.BookStore\src\Acme.BookStore.Domain\Data\BookStoreDbMigrationService.cs: riga 95
   in Acme.BookStore.Data.BookStoreDbMigrationService.<MigrateAsync>d__9.MoveNext() in C:\Users\GordonGekko87\source\repos\Acme.BookStore\src\Acme.BookStore.Domain\Data\BookStoreDbMigrationService.cs: riga 52
   in Acme.BookStore.DbMigrator.DbMigratorHostedService.<StartAsync>d__3.MoveNext() in C:\Users\GordonGekko87\source\repos\Acme.BookStore\src\Acme.BookStore.DbMigrator\DbMigratorHostedService.cs: riga 36
   in Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__12.MoveNext()
   in Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   in Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   in Acme.BookStore.DbMigrator.Program.<Main>d__0.MoveNext() in C:\Users\GordonGekko87\source\repos\Acme.BookStore\src\Acme.BookStore.DbMigrator\Program.cs: riga 30

I tried reinstalling Microsoft SQL Server and searching online for a solution but couldn't find it...

Searching the entire Data Source solution I get this code

private static SqliteConnection CreateDatabaseAndGetConnection()
    {
        var connection = new SqliteConnection("Data Source=:memory:");
        connection.Open();

        var options = new DbContextOptionsBuilder<BookStoreDbContext>()
            .UseSqlite(connection)
            .Options;

        using (var context = new BookStoreDbContext(options))
        {
            context.GetService<IRelationalDatabaseCreator>().CreateTables();
        }

        return connection;
    }

I add a YouTube link that shows how I create the project Here

0

There are 0 best solutions below