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

Activities of "nicolaslau"

I add some addtional data to user claims using UserClaimsPrincipalFactory and using the data to do datafilter. the data can accessed through MyCustomAppSession

After this, i will write unit(integrated) test to test some method using datafilter.

My Question:

  1. how to set the data of MyCustomAppSession lika other testcase "AbpSession.Id=xxx"?
  2. how to set claim data that can be accessed by DbContext(for datafilter) in testcase?
  3. how to disable datafilter in testcase?

Thanks.

I need to import some data (tenants, users, organzation etc) from legacy system. and i want keep the id column with the same value. so i need to set the id value explictly.

             await dbContext.Database.ExecuteSqlCommandAsync("SET IDENTITY_INSERT dbo.AbpTenants ON");

            using (var uow = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
            {
                var legacyTenants = await _legacySysTenantRepository.GetAll().ToListAsync();
                
                foreach (var legacy in legacyTenants)
                {

                    var tenantId = await _tenantManager.CreateWithAdminUserAsync(
                            tenancyName: legacy.BusinessCode,
                            name: legacy.TenantName,
                            adminEmailAddress: $"admin@{legacy.TenantDomain}",
                            adminPassword: $"xxxxxxxxxx",
                            connectionString: null,
                            isActive: legacy.Enabled == 0,
                            editionId: 1,
                            shouldChangePasswordOnNextLogin: false,
                            sendActivationEmail: false,
                            subscriptionEndDate: null,
                            isInTrialPeriod: false,
                            emailActivationLink: null,
                            specifiedId: legacy.Id // i changed this methods to assing Id to AbpTenants`s Id
                        );
                }

                await uow.CompleteAsync();`
                
                await dbContext.Database.ExecuteSqlCommandAsync("SET IDENTITY_INSERT dbo.AbpTenants OFF");

but it throw exception

' {System.Data.SqlClient.SqlException (0x80131904): Cannot insert explicit value for identity column in table 'AbpTenants' when IDENTITY_INSERT is set to OFF. at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__122_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) ClientConnectionId:30b0f3f6-84ff-4a73-afd1-0579643388c6 Error Number:544,State:1,Class:16} '

i try a normal way to enable ef core`s logging by setting in appsetting.json

"Logging": { "LogLevel": { "Microsoft.EntityFrameworkCore": "Debug" } }

but i cann`t see any sql logging in log file.

abpzero v7.0.0

When click Save button(every page include save), javascript erro is thrown.

app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1 Uncaught ReferenceError: rRb is not defined
    at Object.info (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at o (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at Object.abp.notify.info (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at <anonymous>:31:28
    at c (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at Object.fireWith [as resolveWith] (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at Object.s.<computed> [as resolve] (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at Function.handleResponse (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at Object.<anonymous> (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)
    at c (app-layout-libs.min.js?v=TinVLFyB-mWKSW9vX5UXb19wmaRDSn8FOpY8WDnSF0I:1)

updated: I use a refresh source code. there is no my own codes. just click save button on every page(like Add Role). And i test it. in mode=development of npm, it works. but in production mode, it fails.

i will use migrator to update my database.when i copy the compiled migrator folder, and run it. i get error missing many dependencies from Migrator.deps.json. i try copy all my dlls from web project. i still get error 'SqlClient.dll version 4.6.0' not found, actually it has a SqlClient.dll with version 4.6.27110.4.

what is the correct process to upgrade/create databse using Migrator in production enviorment?

abpzero:7.0.0 nodejs: yarn: 1.16.0 npm:12.3.1 webpack 4.32.2

....more errors like above

Showing 1 to 6 of 6 entries