Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "smry"

@yekalkan - nope, I deleted the entire DB and on re-build it still fails with that error The only solution I had was to remove migrations back to before the first Entity creation

Starting from a fresh template and redoing the process, no errors were found.

@maliming - within the past few days we:

  1. created a tenant with its own DB
  2. added a tenant with shared host db
  3. Added an entity with the Power Tool
  4. Added new Tenant with its own DB
    1. Errors here:
2019-12-19 10:01:44 | An error occured during migration of tenant database:
2019-12-19 10:01:44 | Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'MyEntity' in the database.
   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.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrate(AbpTenantBase tenant, Action`1 seedAction)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrateForTenant(AbpTenantBase tenant, Action`1 seedAction)
   at Abp.Zero.EntityFrameworkCore.AbpZeroDbMigrator`1.CreateOrMigrateForTenant(AbpTenantBase tenant)
   at medrx.Migrator.MultiTenantMigrateExecuter.Run(Boolean skipConnVerification) in C:\dev\webProj\medRx-API\src\medrx.Migrator\MultiTenantMigrateExecuter.cs:line 90
ClientConnectionId:[...]
Error Number:2714,State:6,Class:16
2019-12-19 10:01:44 | Skipped this tenant and will continue for others...
2019-12-19 10:01:44 | Tenant database migration completed. (1 / 2)
2019-12-19 10:01:44 | --------------------------------------------------------

There were a handful of other minor changes that were also done in-between steps 3 and 4 so I am unfortunately not able to identify a better recreation of steps for the error – I wanted to make sure that this was mentioned since I also saw an issue in the same location that nitinrpatel did – although may ultimately be unrelated

I’ll make sure to update should I figure out how to clear the error – as of now it does create all databases so I can work around it in some capacity

        public async Task<int> CreateWithAdminUserAsync(...)
                {
                    int newTenantId;
                    long newAdminId;

        await CheckEditionAsync(editionId, isInTrialPeriod);

        using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
        {
            //Create tenant
            var tenant = new Tenant(tenancyName, name)
            {
                IsActive = isActive,
                EditionId = editionId,
                SubscriptionEndDateUtc = subscriptionEndDate?.ToUniversalTime(),
                IsInTrialPeriod = isInTrialPeriod,
                ConnectionString = connectionString.IsNullOrWhiteSpace() ? null :                SimpleStringCipher.Instance.Encrypt(connectionString)
            };

            try
            {
            await CreateAsync(tenant);
            await _unitOfWorkManager.Current.SaveChangesAsync(); //To get new tenant's id.

            //Create tenant database
            _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);
            }
            catch (Exception ex)
            {
                //Fails here: {"There is already an object named 'MyPowerToolCreatedEntity' in the database."}
            }
            

Im having this same issue but different failure. It seems to fail due to an entity that was created with the Power Tool. My code fails a few lines above where nitinrpatel's code fails. It creates the database in the right location but _abpZeroDbMigrator.CreateOrMigrateForTenant(tenant); fails saying "There is already an object named 'MyPowerToolCreatedEntity' in the database."

redownloaded my project, changed just that file in that way, built/rebuilt/npm/yarn - working solution At this point I believe that was my issue and starting from scratch seemed to correct the issue

launchsettings for just the Host file or all files? I am still running into what I believe is this issue

Showing 61 to 65 of 65 entries