- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Asp.net core WebAPI FetchQueryAsync cannot be inferred from the usage.
Joined: 11-Aug-2022
Hello, Exploring latest LLBLGen Pro Framework via the following documentation and getting the further below error.
I followed the console app getting started example and was able to retrieve database records via the adapter fine.
Database is Azure SQL.
Now trying the same via NET Core Web API.
This has been done and the projects have been added and referenced. To get started, in your project in the LLBLGen Pro designer, create per entity a new derived element, optionally include related elements and denormalize them if needed. Choose for derived model target framework the DTO classes framework. When generating code you get, besides the two Adapter projects, also two projects: the DTO classes project and a DTO persistence project.
My apologies if i am missing something basic and appreciate any guidance you can provide.
Severity Code Description Project File Line Suppression State Error CS0411 The type arguments for method 'DataAccessAdapterCore.FetchQueryAsync<T>(string, object)' cannot be inferred from the usage. Try specifying the type arguments explicitly. ASPNETCoreWebAPI C:\Users\krikaw01\source\repos\Code\ASPNETCoreWebAPI\Controllers\WebAPIController.cs 35 Active
AppReviewItem is the DTO
ReviewItem is the Entity
using AppDTOs.DtoClasses;
using AppDTOs.Persistence;
using Microsoft.AspNetCore.Mvc;
using SD.LLBLGen.Pro.QuerySpec;
using SD.LLBLGen.Pro.QuerySpec.Adapter;
using Test.DatabaseSpecific;
using Test.EntityClasses;
using Test.FactoryClasses;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace ASPNETCoreWebAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class WebAPIController : ControllerBase
{
// GET: api/<ValuesController>
[HttpGet]
public async Task<IEnumerable<AppReviewItem>> GetAsync()
{
// Use a queryspec query which is directly projected to the DTO class hierarchy
// at hand and returned in a list. A limit is specified as the OrderBy will end up in
// a subquery which requires a limit.
var qf = new QueryFactory();
var q = qf.ReviewItem.Limit(10000);
using (var adapter = new DataAccessAdapter())
{
// asp.net core doesn't have a synchronization context so we don't need to
// call ConfigureAwait(false)
return await adapter.FetchQueryAsync(q);
}
}
Source code generator process results Code generation tasks execution results Code generation results for code generation task for source 'Entity Model' Task execution log of tasks for group ''. Task execution started on: 11-Aug-2022 11:14.41 Task group: SD.Presets.Adapter.General. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task group: SD.Tasks.Adapter.DatabaseGeneric. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task: Remove FieldInfoProvider class (SD.Tasks.Base.FileRemover) File to remove 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\FieldInfoProvider.cs' was already removed. Task ignored. Task: Remove InheritanceInfoProvider class (SD.Tasks.Base.FileRemover) File to remove 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\InheritanceInfoProvider.cs' was already removed. Task ignored. Task: Remove EntityFieldsFactory class if it's no longer wanted (SD.Tasks.Base.FileRemover) File to remove 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\FactoryClasses\EntityFieldsFactory.cs' was already removed. Task ignored. Task: Remove EntityFieldFactory class if it's no longer wanted (SD.Tasks.Base.FileRemover) File to remove 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\FactoryClasses\EntityFieldFactory.cs' was already removed. Task ignored. Task: Remove DatabaseGeneric vs project file in old location (SD.Tasks.Base.FileRemover) File to remove 'C:\Users\krikaw01\source\repos\.\Code\Test.csproj' was already removed. Task ignored. Task: Remove RelationClasses folder (SD.Tasks.Base.DirectoryRemover) Task: Remove Linq folder (SD.Tasks.Base.DirectoryRemover) Task: SD.Tasks.Adapter.DbGenericProjectDirectoryCreator Directory 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric' created/preserved successfully. Task: SD.Tasks.Adapter.EntityCollectionClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\EntityCollection.cs' successfully. Task: SD.Tasks.Generic.AssemblyInfoFileGenerator File 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\AssemblyInfo.cs' is not overwritten because it already exists and failWhenExistent is true. Task: SD.Tasks.Generic.ConstantsEnumsFileGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\ConstantsEnums.cs' successfully. Task: SD.Tasks.Generic.ModelInfoProviderClassGenerator Template assembly source code written to C:\Users\krikaw01\AppData\Local\Temp\2D18D138-1DD2-467E-86CC-4838250611AE\templatesSource.cs. Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\ModelInfoProvider.cs' successfully. Task: SD.Tasks.Generic.TypeDefaultValueClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\TypeDefaultValue.cs' successfully. Task: SD.Tasks.Generic.LinqMetaDataClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\LinqMetaData.cs' successfully. Task: SD.Tasks.Generic.QuerySpecFactoryClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\FactoryClasses\QueryFactory.cs' successfully. Task: SD.Tasks.Generic.DynamicRelationClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\DynamicRelation.cs' successfully. Task: SD.Tasks.Adapter.CommonBaseClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\CommonEntityBase.cs' successfully. Task: SD.Tasks.Generic.EntityClassesGenerator Code generated for entity 'App.Adjustment' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\AdjustmentEntity.cs' successfully. Code generated for entity 'App.AdjustmentDetail' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\AdjustmentDetailEntity.cs' successfully. Code generated for entity 'App.AdjustmentsPayCheck' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\AdjustmentsPayCheckEntity.cs' successfully. Code generated for entity 'App.Comment' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\CommentEntity.cs' successfully. Code generated for entity 'App.PayCheck' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\PayCheckEntity.cs' successfully. Code generated for entity 'App.PayCheckTaxis' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\PayCheckTaxisEntity.cs' successfully. Code generated for entity 'App.ReviewItem' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\ReviewItemEntity.cs' successfully. Code generated for entity 'App.ReviewItemsOld' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\ReviewItemsOldEntity.cs' successfully. Code generated for entity 'App.ReviewItemStatuses' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\ReviewItemStatusesEntity.cs' successfully. Code generated for entity 'App.ReviewItemType' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\ReviewItemTypeEntity.cs' successfully. Code generated for entity 'App.TaxCode' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\TaxCodeEntity.cs' successfully. Code generated for entity 'App.User' into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\EntityClasses\UserEntity.cs' successfully. Task: SD.Tasks.Generic.EntityFactoryClassesGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\FactoryClasses\EntityFactories.cs' successfully. TaskGroupElement 'SD.Tasks.Generic.EntityFieldFactoryClassGenerator' was skipped because its Perform Rule resolved to false. TaskGroupElement 'SD.Tasks.Generic.EntityFieldsFactoryClassGenerator' was skipped because its Perform Rule resolved to false. Task: SD.Tasks.Generic.TvfCallFactoryClassGenerator Task: SD.Tasks.Generic.ResultsetFieldsClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\ResultsetFields.cs' successfully. Task: SD.Tasks.Generic.FieldCreationClassesGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\HelperClasses\FieldCreationClasses.cs' successfully. Task: SD.Tasks.Generic.TypedListClassGenerator Task: SD.Tasks.Generic.TypedListPocoRowClassGenerator Task: SD.Tasks.Generic.TypedViewClassGenerator Task: SD.Tasks.Generic.TypedViewPocoRowClassGenerator Task: SD.Tasks.Adapter.VsNetDbGenericProjectFileCreator Cleaned up project file. Project file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseGeneric\Test.csproj' has been altered successfully. Task group: SD.Tasks.Adapter.DatabaseSpecific. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task: Remove DatabaseSpecific vs project file in old location (SD.Tasks.Base.FileRemover) File to remove 'C:\Users\krikaw01\source\repos\.\Code\TestDBSpecific.csproj' was already removed. Task ignored. Task: SD.Tasks.Generic.AssemblyInfoFileGenerator File 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\AssemblyInfo.cs' is not overwritten because it already exists and failWhenExistent is true. Task: SD.Tasks.Generic.PersistenceInfoProviderClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\PersistenceInfoProvider.cs' successfully. Task: SD.Tasks.Generic.AppConfigFileGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\App.config' successfully. Task: SD.Tasks.Generic.ActionProceduresClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\ActionProcedures.cs' successfully. Task: SD.Tasks.Generic.RetrievalProceduresClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\RetrievalProcedures.cs' successfully. Task: SD.Tasks.Adapter.DataAccessAdapterClassGenerator Code generated for generic directive into file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\DataAccessAdapter.cs' successfully. Task: SD.Tasks.Adapter.VsNetDbSpecificProjectFileCreator Cleaned up project file. Project file 'C:\Users\krikaw01\source\repos\.\Code\DatabaseSpecific\TestDBSpecific.csproj' has been altered successfully. Task group: SD.Tasks.Adapter.Webservices.SchemaImporter. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task execution ended on: 11-Aug-2022 11:14.42 Code generation results for code generation task for source 'AppDtos' Task execution log of tasks for group ''. Task execution started on: 11-Aug-2022 11:14.42 Task group: SD.DTOClasses.ReadWriteDTOs. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task group: Generate DTO Class Model (SD.Tasks.Base.GenericTaskGroup). For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task: Generate Root Derived Element Classes (SD.Tasks.Base.ConsumeLptTemplate) Template assembly source code written to C:\Users\krikaw01\AppData\Local\Temp\2D18D138-1DD2-467E-86CC-4838250611AE\templatesSource.cs. Code generated for rootderivedelement 'AppDtos.AppReviewItem' into file 'C:\Users\krikaw01\source\repos\.\Code\AppDTOs\AppReviewItem.cs' successfully. Task: Generate Visual Studio project file (SD.Tasks.Base.GenerateVSNetProject) Cleaned up project file. Project file 'C:\Users\krikaw01\source\repos\.\Code\AppDTOs\AppDTOs.csproj' has been preserved successfully. Task group: Generate DTO Read-Write Persistence Class Model (SD.Tasks.Base.GenericTaskGroup). For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE). Task: Generate Root Derived Element Persistence Classes (SD.Tasks.Base.ConsumeLptTemplate) Code generated for rootderivedelement 'AppDtos.AppReviewItem' into file 'C:\Users\krikaw01\source\repos\.\Code\AppDTOs.Persistence\AppReviewItemPersistence.cs' successfully. Task: Generate Visual Studio project file (SD.Tasks.Base.GenerateVSNetProject) Cleaned up project file. Project file 'C:\Users\krikaw01\source\repos\.\Code\AppDTOs.Persistence\AppDTOs.Persistence.csproj' has been preserved successfully. Task execution ended on: 11-Aug-2022 11:14.42
Joined: 11-Aug-2022
Its the latest LLBL Gen Pro release 5.9 (5.9.2)
Yea NET 6
See attached screenshots for more details....
`<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <TargetFramework>net6.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> </PropertyGroup>
<ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.8" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.8" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> </ItemGroup>
<ItemGroup> <ProjectReference Include="..\AppDTOs.Persistence\AppDTOs.Persistence.csproj" /> <ProjectReference Include="..\AppDTOs\AppDTOs.csproj" /> <ProjectReference Include="..\DatabaseGeneric\Test.csproj" /> <ProjectReference Include="..\DatabaseSpecific\TestDBSpecific.csproj" /> </ItemGroup>
<ItemGroup> <Reference Include="SD.LLBLGen.Pro.DQE.SqlServer"> <HintPath>............\Program Files (x86)\Solutions Design\LLBLGen Pro v5.9\Frameworks\LLBLGen Pro\RuntimeLibraries\CompiledRuntimeLibraries\SD.LLBLGen.Pro.DQE.SqlServer.dll</HintPath> </Reference> <Reference Include="SD.LLBLGen.Pro.ORMSupportClasses"> <HintPath>............\Program Files (x86)\Solutions Design\LLBLGen Pro v5.9\Frameworks\LLBLGen Pro\RuntimeLibraries\CompiledRuntimeLibraries\SD.LLBLGen.Pro.ORMSupportClasses.dll</HintPath> </Reference> </ItemGroup>
</Project> `
Filename | File size | Added on | Approval |
---|---|---|---|
Screenshots.png | 391,819 | 12-Aug-2022 04:07.20 | Approved |