Base solution for your next web application

Activities of "[email protected]"

Hi @ismcagdas,

I can't share the code due to company policy. but would like to let you know that i've made replica of User, User Manager, User Store, Role, Role Manager, Role Store, Tenant Manager using second db context.

Thanks, Prasanna.

Hi,

The requirement is as follows: We'll be adding data in one project, on the fly data should be inserted into other database with the reference of ids from first database tables. we are using aspnet zero projects.

For example: If i create a tenant in first database, corresponding all tables which are effected with tenant creation data should be dumped into second database.

Implemented using below sample code https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/MultipleDbContextEfCoreDemo. But I'm able to insert only Tenant, user, role tables information, & others tables information are not getting inserting (AbpUserAccounts, AbpPermissions, Notifications) and I'm getting error if i include code related to UserRole in tenant creation of second db context.

System.InvalidOperationException: Cannot use multiple DbContext instances within a single query execution. Ensure the query uses a single context instance. at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.VisitConstant(ConstantExpression constantExpression) at System.Linq.Expressions.ConstantExpression.Accept(ExpressionVisitor visitor) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.ExtractParameters(Expression expression) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExtractParameters(Expression query, IParameterValues parameterValues, IDiagnosticsLogger`1 logger, Boolean parameterize, Boolean generateContextAccessors) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken) at Microsoft.En...

Can you please help me out how to acheive my requirement ?

Thanks.

FIxed issue and working as expected, My Bad missed few things while implementing.

Hi Team, I've gone thorugh following link and implemented similiar way, But I'm unable to insert data into different databases in single service call. https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/MultipleDbContextEfCoreDemo Following below is the error which i'm getting: Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert explicit value for identity column in table 'XXX' when IDENTITY_INSERT is set to OFF. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__164_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj) 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.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location where exception was thrown --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) ClientConnectionId:30c970df-00b5-4599-b270-950cd92bfdbc Error Number:544,State:1,Class:16 --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, Cancellat...

Requirement is as follows below: First I would like to insert data and retreive ID and assign value to the property of other table in second database and insert the data into second database

Can you please help me out to fix the issue.

Thanks in Advance, Prasanna.

Hi @maliming, Issue was all together different,It was the issue with localization where name attribute was not correctly added in xml. I'm Sorry, unneccessarily wasted your time.

Thanks, Prasanna

Hi Team,

I've recently update abp version and tried to redeploy application into azure web app using azure devops. Angular Project got deployed successfully but in API Project i'm unable to deploy database to azure sql server and I'm able execute the application perfectly in my local machine... Following is the screenshot of error:

Project Details : Web Application - .NET Core 2.2 Angular - 7

Can you guys please help me out to fix the issue.

Thanks in advance, Prasanna.

Hi tony clark... Following piece of code added in web.config of asp.net core project.

    &lt;environmentVariable name=&quot;ASPNETCORE_ENVIRONMENT&quot; value=&quot;Development&quot;&gt;&lt;/environmentVariable&gt;

@ismcagdas issue fixed by changes code as above mentioned.

Thanks,

Hi Team,

In our Application, we need to have entity history for permissions as well. I mean whenever userrole or role permissions are changed then permissions has to be logged in entity history related tables.

Can you please let me know how to achieve it.

Thanks in Advance, Prasanna.

My Bad... Above mentioned issue has been fixed by adding evironment variable in web.config for specific envionment.

Showing 1 to 10 of 11 entries