hi
I think you can only use the
dotnet ef migrations script
to get the script on each project.The migratory tool just applies the migration and seeds the data.
That's fine, we will generate manually for DB structural changes. but do we have any other way to generate the insert scripts for data seeding from the Migration tool right? Mainly for Permission, Roles and Tenant specific data.
Also sometimes we are getting the Generated SQL file as empty, any idea on that? for the below code
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace XXXX.Migrations
{
public partial class ImportHistoryLogImportRunHistory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CustomField1",
table: "EmployeeServiceImportRunHistories",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField2",
table: "EmployeeServiceImportRunHistories",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField3",
table: "EmployeeServiceImportRunHistories",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField4",
table: "EmployeeServiceImportRunHistories",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField5",
table: "EmployeeServiceImportRunHistories",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RowNo",
table: "EmployeeServiceImportRunHistories",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField1",
table: "EmployeeServiceImportHistroyLogs",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField2",
table: "EmployeeServiceImportHistroyLogs",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField3",
table: "EmployeeServiceImportHistroyLogs",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField4",
table: "EmployeeServiceImportHistroyLogs",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CustomField5",
table: "EmployeeServiceImportHistroyLogs",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RowNo",
table: "EmployeeServiceImportHistroyLogs",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CustomField1",
table: "EmployeeServiceImportRunHistories");
migrationBuilder.DropColumn(
name: "CustomField2",
table: "EmployeeServiceImportRunHistories");
migrationBuilder.DropColumn(
name: "CustomField3",
table: "EmployeeServiceImportRunHistories");
migrationBuilder.DropColumn(
name: "CustomField4",
table: "EmployeeServiceImportRunHistories");
migrationBuilder.DropColumn(
name: "CustomField5",
table: "EmployeeServiceImportRunHistories");
migrationBuilder.DropColumn(
name: "RowNo",
table: "EmployeeServiceImportRunHistories");
migrationBuilder.DropColumn(
name: "CustomField1",
table: "EmployeeServiceImportHistroyLogs");
migrationBuilder.DropColumn(
name: "CustomField2",
table: "EmployeeServiceImportHistroyLogs");
migrationBuilder.DropColumn(
name: "CustomField3",
table: "EmployeeServiceImportHistroyLogs");
migrationBuilder.DropColumn(
name: "CustomField4",
table: "EmployeeServiceImportHistroyLogs");
migrationBuilder.DropColumn(
name: "CustomField5",
table: "EmployeeServiceImportHistroyLogs");
migrationBuilder.DropColumn(
name: "RowNo",
table: "EmployeeServiceImportHistroyLogs");
}
}
}
Thanks
We are still preparing the sample solutions, will share by tomorrow max
hi
We don't familiar with MongoDB, You can create a sample project with ef core.
We will try to provide a sample in two days to continue our discussion.
hi
As per the EF (in general) the update statement should handle the scenario and it should prepare the update statement with update of 2 fields only not for all...
You are using ef core 6.x, have you tried the ef core 7?
We didn't tried the ef core 7 and we are middle of ABP 7 upgrade. do you mean after ef 7 the concern will handle automatically for both SQL & Mongo?
But still we had to pass the Entire Update DTO even we update few properties right? any work around for the same or do we need to write the custom method to do so.
//Add this app.MapWhen( ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/api-definition") || ctx.Request.Path.ToString().TrimEnd('/').Equals(""), app2 => { app2.UseRouting(); app2.UseConfiguredEndpoints(); } ); app.UseRewriter(new RewriteOptions() // Regex for "", "/" and "" (whitespace) .AddRedirect("^(|\\|\\s+)$", "/swagger")); app.UseOcelot().Wait();
Thanks liangshiwei, it worked perfectly. In fact we added the user Task API in WebGateway and modified the octlog configuration but missed the below change mentioned.
Can you guys please update the documentation to include the above steps. (https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice) which might be helpful for others as well
Hi,
Thanks for the inputs, it got succussed partially when I executed Step 1: proxies got generated only for Sample Controller
There are two API definitions only uppercase and lowercase letters differ,
You can try
-m UserTaskService
Also We would like to understand why dynamic proxies are not working
You have to reference the
UserTaskService.HttpApi
project and add module dependency toAppV3WebModule
if you want to use dynamic proxies.Using dynamic proxies will make things easier, you don't have to generate static proxy files and can remove those files.
After couple of redoing from starting of creation of service, Now we are able to get the Proxies generated with dynamic proxies only and now js proxies are available
and from webgateway the method is being called successfully as well
but now getting some different error When we are trying to call the methods using AppService (IMasterDataObjectsAppService)
getting the below error
error log is below
2023-04-24 08:31:08.942 +05:30 [INF] Executed page /MasterDataObjects/Index in 23651.965ms
2023-04-24 08:31:08.942 +05:30 [INF] Executed endpoint '/MasterDataObjects/Index'
2023-04-24 08:31:08.946 +05:30 [ERR] An unhandled exception has occurred while executing the request.
Volo.Abp.AbpException: Could not found remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto
1[XXX.XX.XX.UserTaskService.MasterDataObjects.MasterDataObjectDto]] GetListAsync(XXX.XX.XX.UserTaskService.MasterDataObjects.GetMasterDataObjectsInput) on the URL: https://localhost:44325
at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(HttpClient client, String baseUrl, Type serviceType, MethodInfo method)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetActionApiDescriptionModel(IAbpMethodInvocation invocation) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor
1.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at XXX.XX.XX.UserTaskService.Web.Pages.MasterDataObjects.IndexModel.OnGetAsync() in C:\Official\EHSWatchV3\repo\EHSWatch_AppV3Upgrade\services\userTask\src\XXX.XX.XX.UserTaskService.Web\Pages\MasterDataObjectsUT\Index.cshtml.cs:line 30
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.
Thanks for the inputs, If we understand correctly we can have different versions of solutions if we move all web pages into web and remove all depended projects (web) from main UI layer. in this case we need to remove reference to contract layer as well? You mention We support this feature after 7.0.0, (It also requires that the service version is 7.0.0.) means this kind of approach will work only after having our entire project running on 7.0 and for future upgraded we can follow this way? please elaborate
- You need to upgrade your project to at least 7.0.0.
- Then delete all references to the services in the web app
- Generate static proxy for web app, it will generate all required files, interfaces, DTO, etc.
Hummm, In simple words at least for this time we need to upgrade all our projects with minimum of ABP 7.0.0 and may be in next upgrades we can decide to upgrade all projects to latest ABP version or just upgrade the specific projects by choice
and what do u mean by "Generate static proxy for web app, it will generate all required files, interfaces, DTO, etc." means we need to generate static proxies for the Web Layer only right. no need to do the same for all micro service projects right.