Hi @maliming Can you take remote access and check, i sent access details to your email.
Thanks.
Hi,
I generated a new view with RAD Tool to check the issue as instructed. but raising the same error in GetAll function. Getting this error while loading all CRUD views.
Thanks.
Hello,
Waiting for the support as we coultdn't resolve it.
Thanks.
Hello,
<span class="colour" style="color: rgb(85, 85, 85);">Does this happen for the newly generated pages ?</span>
Yes, tried with a newly generated view, but that view also has the same problem.
public async Task<PagedResultDto<GetTestForViewDto>> GetAll(GetAllTestsInput input)
{
var filteredTests = _testRepository.GetAll()
.Include( e => e.CostCenterFk)
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.test1.Contains(input.Filter) || e.test2.Contains(input.Filter))
.WhereIf(!string.IsNullOrWhiteSpace(input.test1Filter), e => e.test1.ToLower() == input.test1Filter.ToLower().Trim())
.WhereIf(!string.IsNullOrWhiteSpace(input.test2Filter), e => e.test2.ToLower() == input.test2Filter.ToLower().Trim())
.WhereIf(input.Mintest3Filter != null, e => e.test3 >= input.Mintest3Filter)
.WhereIf(input.Maxtest3Filter != null, e => e.test3 <= input.Maxtest3Filter)
.WhereIf(!string.IsNullOrWhiteSpace(input.CostCenterNameFilter), e => e.CostCenterFk != null && e.CostCenterFk.Name.ToLower() == input.CostCenterNameFilter.ToLower().Trim());
var pagedAndFilteredTests = filteredTests
.OrderBy(input.Sorting ?? "id asc")
.PageBy(input);
var tests = from o in pagedAndFilteredTests
join o1 in _lookup_costCenterRepository.GetAll() on o.CostCenterId equals o1.Id into j1
from s1 in j1.DefaultIfEmpty()
select new GetTestForViewDto() {
Test = new TestDto
{
test1 = o.test1,
test2 = o.test2,
test3 = o.test3,
Id = o.Id
},
CostCenterName = s1 == null ? "" : s1.Name.ToString()
};
var totalCount = await filteredTests.CountAsync();
return new PagedResultDto<GetTestForViewDto>(
totalCount,
await tests.ToListAsync()
);
}
Noticed that getting the error in the join section.
join o1 in _lookup_costCenterRepository.GetAll() on o.CostCenterId equals o1.Id into j1
Error details from error log:
ERROR 2019-11-15 09:26:31,077 [56 ] Mvc.ExceptionHandling.AbpExceptionFilter - The LINQ expression 'Where<CostCenter>(
source: DbSet<CostCenter>,
predicate: (c) => Contains<long>(
source: (Unhandled parameter: __ef_filter__AssociatedOuIds_2),
value: ((IMustHaveOrganizationUnit)c).OrganizationUnitId) || (Nullable<long>)((IMustHaveOrganizationUnit)c).OrganizationUnitId == (Unhandled parameter: __ef_filter__CurrentOUId_3) == (Unhandled parameter: __ef_filter__IsOUFilterEnabled_4) && !(((ISoftDelete)c).IsDeleted) || ((ISoftDelete)c).IsDeleted != (Unhandled parameter: __ef_filter__IsSoftDeleteFilterEnabled_5) && ((IMayHaveTenant)c).TenantId == (Unhandled parameter: __ef_filter__CurrentTenantId_6) || ((IMustHaveTenant)c).TenantId == 0 == (Unhandled parameter: __ef_filter__IsMustHaveTenantFilterEnabled_7))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
System.InvalidOperationException: The LINQ expression 'Where<CostCenter>(
source: DbSet<CostCenter>,
predicate: (c) => Contains<long>(
source: (Unhandled parameter: __ef_filter__AssociatedOuIds_2),
value: ((IMustHaveOrganizationUnit)c).OrganizationUnitId) || (Nullable<long>)((IMustHaveOrganizationUnit)c).OrganizationUnitId == (Unhandled parameter: __ef_filter__CurrentOUId_3) == (Unhandled parameter: __ef_filter__IsOUFilterEnabled_4) && !(((ISoftDelete)c).IsDeleted) || ((ISoftDelete)c).IsDeleted != (Unhandled parameter: __ef_filter__IsSoftDeleteFilterEnabled_5) && ((IMayHaveTenant)c).TenantId == (Unhandled parameter: __ef_filter__CurrentTenantId_6) || ((IMustHaveTenant)c).TenantId == 0 == (Unhandled parameter: __ef_filter__IsMustHaveTenantFilterEnabled_7))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|8_0(ShapedQueryExpression translated, <>c__DisplayClass8_0& )
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)
at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at ioNob.h2oERP.Tes.TestsAppService.GetAll(GetAllTestsInput input) in D:\GitRepo\h2oERPZero\aspnet-core\src\ioNob.h2oERP.Application\Tes\TestsAppService.cs:line 71
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
One more thing I need to add that, we extended DbContext filter section for filtering OU and associated OU to filter data as the user should not see any data who don't have permission on particular OU, so data should be filtered based on listed OU Ids.
protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>()
{
var expression = base.CreateFilterExpression<TEntity>();
expression = null;
if (typeof(IMayHaveOrganizationUnit).IsAssignableFrom(typeof(TEntity)))
{
Expression<Func<TEntity, bool>> mayHaveOUFilter = e =>
AssociatedOuIds.Contains((long)((IMayHaveOrganizationUnit)e).OrganizationUnitId) ||
(((IMayHaveOrganizationUnit)e).OrganizationUnitId == CurrentOUId) == IsOUFilterEnabled;
expression = expression == null ? mayHaveOUFilter : CombineExpressions(expression, mayHaveOUFilter);
}
if (typeof(IMustHaveOrganizationUnit).IsAssignableFrom(typeof(TEntity)))
{
Expression<Func<TEntity, bool>> mayHaveOUFilter = e =>
AssociatedOuIds.Contains(((IMustHaveOrganizationUnit)e).OrganizationUnitId) ||
(((IMustHaveOrganizationUnit)e).OrganizationUnitId == CurrentOUId) == IsOUFilterEnabled;
expression = expression == null ? mayHaveOUFilter : CombineExpressions(expression, mayHaveOUFilter);
}
We are stuck here and quick support will be helpful to move with.
Thank You.
Yes. There was an error and removed those and tried. But no luck.
EntityFrameworkCore.csproj(73,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.2.401\Microsoft\VisualStudio\v16.0\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
The build failed. Please fix the build errors and run again.
Removed a line from project file and tried to run the app. But still the same issue. Sometimes getting another error as
This happens only in a single pc. Tried to reinstall the VS, But no luck.
Thanks.
Hi maliming,
Thanks for your support, it worked,
Should I upgrade "moment-timezone": "^0.5.25" to "^0.5.27" ?
Hi maliming,
I shared the code, please have a look.
Thanks.
Shared, please connect
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"abp-zero-template": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.json",
"polyfills": "src/polyfills.ts",
"preserveSymlinks": true,
"assets": [
"src/assets",
"src/metronic",
"src/favicon.ico",
{
"glob": "abp.signalr-client.js",
"input": "node_modules/abp-web-resources/Abp/Framework/scripts/libs",
"output": "/assets/abp"
}
],
"styles": [
"node_modules/
animate.css/animate.min.css
",
"node_modules/quill/dist/quill.core.css",
"node_modules/quill/dist/quill.snow.css",
"node_modules/famfamfam-flags/dist/sprite/famfamfam-flags.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeicons/primeicons.css",
"node_modules/sweetalert2/dist/sweetalert2.css",
"node_modules/cookieconsent/build/cookieconsent.min.css",
"node_modules/@ng-select/ng-select/themes/default.theme.css",
"src/assets/FreezeUI/freeze-ui.min.css",
"src/assets/primeng/file-upload/css/primeng.file-upload.css",
"src/assets/primeng/autocomplete/css/primeng.autocomplete.css",
"src/assets/primeng/tree/css/primeng.tree.css",
"src/assets/primeng/context-menu/css/primeng.context-menu.css",
"src/assets/fonts/fonts-poppins.css",
"src/assets/fonts/fonts-roboto.css",
"src/assets/ngx-bootstrap/bs-datepicker.css",
"src/assets/metronic/vendors/global/vendors.bundle.css",
"src/app/shared/core.less",
"src/app/shared/layout/layout.less",
"src/styles.css",
//"node_modules/select2/dist/css/select2.min.css"
"node_modules/summernote/dist/summernote-lite.css"
],
"scripts": [
"node_modules/@aspnet/signalr/dist/browser/signalr.min.js",
"node_modules/localforage/dist/localforage.js",
"node_modules/moment/min/moment-with-locales.js",
"node_modules/moment-timezone/builds/moment-timezone-with-data.js",
"node_modules/
push.js/bin/push.js
",
"node_modules/quill/dist/quill.js",
"node_modules/sweetalert2/dist/sweetalert2.js",
"node_modules/cookieconsent/build/cookieconsent.min.js",
"src/assets/FreezeUI/freeze-ui.js",
"src/assets/abp-web-resources/abp.js",
"src/assets/abp-web-resources/abp.sweet-alert.js",
"src/assets/abp-web-resources/abp.notify.js",
"src/assets/abp-web-resources/abp.freeze-ui.js",
"src/assets/canvas-toBlob/canvas-toBlob.js",
"node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.moment.js",
"src/assets/metronic/vendors/global/vendors.bundle.js",
"src/assets/metronic/common/js/scripts.bundle.js",
"node_modules/jquery/dist/jquery.min.js",
"node_modules/summernote/dist/summernote-lite.js",
"node_modules/@webcomponents/custom-elements/src/native-shim.js"
//"node_modules/select2/dist/js/select2.min.js"
]
},
"configurations": {
"hmr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.hmr.ts"
}
]
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "abp-zero-template:build"
},
"configurations": {
"hmr": {
"browserTarget": "abp-zero-template:build:hmr"
},
"production": {
"browserTarget": "abp-zero-template:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "abp-zero-template:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "src/tsconfig.json",
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"styles": [
"node_modules/
animate.css/animate.min.css
",
"node_modules/quill/dist/quill.core.css",
"node_modules/quill/dist/quill.snow.css",
"node_modules/famfamfam-flags/dist/sprite/famfamfam-flags.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeicons/primeicons.css",
"node_modules/sweetalert2/dist/sweetalert2.css",
"node_modules/cookieconsent/build/cookieconsent.min.css",
"node_modules/@ng-select/ng-select/themes/default.theme.css",
"src/assets/FreezeUI/freeze-ui.min.css",
"src/assets/primeng/file-upload/css/primeng.file-upload.css",
"src/assets/primeng/autocomplete/css/primeng.autocomplete.css",
"src/assets/primeng/tree/css/primeng.tree.css",
"src/assets/primeng/context-menu/css/primeng.context-menu.css",
"src/assets/fonts/fonts-poppins.css",
"src/assets/fonts/fonts-roboto.css",
"src/assets/ngx-bootstrap/bs-datepicker.css",
"src/assets/metronic/vendors/global/vendors.bundle.css",
"src/app/shared/core.less",
"src/app/shared/layout/layout.less",
"src/styles.css",
//"node_modules/select2/dist/css/select2.min.css"
"node_modules/summernote/dist/summernote-lite.css"
],
"scripts": [
"node_modules/@aspnet/signalr/dist/browser/signalr.min.js",
"node_modules/localforage/dist/localforage.js",
"node_modules/moment/min/moment-with-locales.js",
"node_modules/moment-timezone/builds/moment-timezone-with-data.js",
"node_modules/
push.js/bin/push.js
",
"node_modules/quill/dist/quill.js",
"node_modules/sweetalert2/dist/sweetalert2.js",
"node_modules/cookieconsent/build/cookieconsent.min.js",
"src/assets/FreezeUI/freeze-ui.js",
"src/assets/abp-web-resources/abp.js",
"src/assets/abp-web-resources/abp.sweet-alert.js",
"src/assets/abp-web-resources/abp.notify.js",
"src/assets/abp-web-resources/abp.freeze-ui.js",
"src/assets/canvas-toBlob/canvas-toBlob.js",
"node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.moment.js",
"src/assets/metronic/vendors/global/vendors.bundle.js",
"src/assets/metronic/common/js/scripts.bundle.js",
"node_modules/jquery/dist/jquery.min.js",
"node_modules/summernote/dist/summernote-lite.js",
//"node_modules/select2/dist/js/select2.min.js"
"node_modules/@webcomponents/custom-elements/src/native-shim.js"
],
"assets": [
"src/assets",
"src/favicon.ico",
{
"glob": "abp.signalr-client.js",
"input": "node_modules/abp-web-resources/Abp/Framework/scripts/libs",
"output": "/assets/abp"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.json"
],
"exclude": []
}
}
}
},
"abp-zero-template-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "abp-zero-template:serve",
"port": 4200
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.json"
],
"exclude": []
}
}
}
}
},
"defaultProject": "abp-zero-template",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}