.Net Standard DbDataReader.GetSchemaTable()

Posts   
 
    
hankddog
User
Posts: 52
Joined: 08-Apr-2005
# Posted on: 13-Feb-2020 23:34:36   

We are using .Net Standard 2.0 with an Azure SQL db. I am using the TyperView and get the following error.

An unhandled exception occurred while processing the request.

NotSupportedException: Specified method is not supported.

System.Data.Common.DbDataReader.GetSchemaTable()
 Stack 
  Query 
  Cookies 
  Headers 
  Routing 


NotSupportedException: Specified method is not supported.

System.Data.Common.DbDataReader.GetSchemaTable()


SD.LLBLGen.Pro.ORMSupportClasses.DataTableFiller.Fill(IDataReader dataSource, DataTable toFill, IFieldPersistenceInfo[] fieldsPersistenceInfo, IRetrievalQuery queryExecuted)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.ExecuteMultiRowDataTableRetrievalQuery(IRetrievalQuery queryToExecute, DbDataAdapter dataAdapterToUse, DataTable tableToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchTypedView(DataTable dataTableToFill, QueryParameters parameters)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.<>n__14(DataTable dataTableToFill, QueryParameters parameters)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase+<>c__DisplayClass15_0.<FetchTypedView>b__0()


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteWithActiveRecoveryStrategy(Action toExecute)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedView(DataTable dataTableToFill, QueryParameters parameters)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchTypedView(IEntityFields2 fieldCollectionToFetch, DataTable dataTableToFill, IRelationPredicateBucket filterBucket, int maxNumberOfItemsToReturn, ISortExpression sortClauses, bool allowDuplicates, IGroupByCollection groupByClause, int pageNumber, int pageSize)


SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.FetchTypedView(ITypedView2 typedViewToFill, IRelationPredicateBucket filterBucket, int maxNumberOfItemsToReturn, ISortExpression sortClauses, bool allowDuplicates)


NH.BRL.Helper.TypedViewHelper.Fill(ITypedView2 tv, IRelationPredicateBucket filter, ISortExpression sort) in TypedViewHelper.cs
+ 






38.             adapter.FetchTypedView(tv, filter, 0, sort, false);








NH.BRL.EntityClass.PlayersBL.GetListByTeamId(int teamId) in PlayersBL.cs
+ 






152.            TypedViewHelper.Fill(tl, pe, sort);








NH.BRL.EntityClass.PlayersBL.AddPlayerMetricsByTeamId(int teamId) in PlayersBL.cs
+ 






163.            tv = GetListByTeamId(teamId);








NHBackEnd.Controllers.HomeController.PlayerMetrics() in HomeController.cs
+ 






39.         NH.BRL.EntityClass.PlayersBL.AddPlayerMetricsByTeamId(1);








lambda_method(Closure , object , object[] )


Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(object target, object[] parameters)


Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)


Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()


Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)


Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()


Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)


Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)


Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()


Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)


Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)


Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)


Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()


Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)


Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)


Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)


Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


I know I must be missing something simple. C# MVC application.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 14-Feb-2020 08:05:16   

Which LLBLGen Pro runtime library version are you using? If you test it against a SQL Server DB instance would it work?

Could you please post the minimum code snippet to reproduce it?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 14-Feb-2020 09:14:24   

Hmm, could also be a .net core versioning issue. Do you use .net core 2.2+? I think if you use .net core 2.0 the method isn't implemented, but could be mistaken. Additionally, it might also be the SqlClient version your using, do you use the new Microsoft.Data.SqlClient or the original System.Data.SqlClient ?

Frans Bouma | Lead developer LLBLGen Pro
hankddog
User
Posts: 52
Joined: 08-Apr-2005
# Posted on: 14-Feb-2020 22:04:30   

Walaa wrote:

Which LLBLGen Pro runtime library version are you using? If you test it against a SQL Server DB instance would it work?

Could you please post the minimum code snippet to reproduce it?

I am using 5.5.1 and .Net Core 3.1. I can save, just not the typed view.

    public static TVPlayerTypedView GetListByTeamId(int teamId)
        {
            TVPlayerTypedView tl;
            RelationPredicateBucket pe;
            SortExpression sort;

            tl = new TVPlayerTypedView();
            pe = new RelationPredicateBucket();
            sort = new SortExpression();
            pe.PredicateExpression.Add(TVPlayerFields.TeamId == teamId);

            sort.Add(TVPlayerFields.LastName | SortOperator.Descending);
            TypedViewHelper.Fill(tl, pe, sort);

            return tl;

        }
TypedViewHelper Class
        static public void Fill(ITypedView2 tv, IRelationPredicateBucket filter, ISortExpression sort)
        {
            using (DataAccessAdapter adapter = new DataAccessAdapter())
            {
                adapter.FetchTypedView(tv, filter, 0, sort, false);
            }
        }

hankddog
User
Posts: 52
Joined: 08-Apr-2005
# Posted on: 14-Feb-2020 22:15:14   

Otis wrote:

Hmm, could also be a .net core versioning issue. Do you use .net core 2.2+? I think if you use .net core 2.0 the method isn't implemented, but could be mistaken. Additionally, it might also be the SqlClient version your using, do you use the new Microsoft.Data.SqlClient or the original System.Data.SqlClient ?

It is using System.Data and ASP.Net Core 3.1. I am using the latest ORM classes from nuget

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 15-Feb-2020 09:49:02   

It's very strange, as the code has been merged into SqlClient for .NET Core in 2017: https://github.com/dotnet/corefx/pull/19864

If you run the code locally on a local sql server, it works fine? It might be something related to .netstandard20 however as this method is not part of .netstandard20 afaik.

Could you create a small test which does the typedview fetch on .net coreapp (not netstandard, but netcoreapp) 3.1 and check whether it still fails?

What's also strange is that it's not thrown by SqlDataReader, but by DbDataReader, as the method is overridden in SqlDataReader, so it looks like the type of the reader isn't SqlDataReader but something else....

Frans Bouma | Lead developer LLBLGen Pro
hankddog
User
Posts: 52
Joined: 08-Apr-2005
# Posted on: 18-Feb-2020 22:29:59   

Otis wrote:

It's very strange, as the code has been merged into SqlClient for .NET Core in 2017: https://github.com/dotnet/corefx/pull/19864

If you run the code locally on a local sql server, it works fine? It might be something related to .netstandard20 however as this method is not part of .netstandard20 afaik.

Could you create a small test which does the typedview fetch on .net coreapp (not netstandard, but netcoreapp) 3.1 and check whether it still fails?

What's also strange is that it's not thrown by SqlDataReader, but by DbDataReader, as the method is overridden in SqlDataReader, so it looks like the type of the reader isn't SqlDataReader but something else....

I changed the Class Library to a .Net Core 3.1 and tried a Typed List as well and same result.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 19-Feb-2020 09:29:31   

All our tests succeed, so could you create a small repro case that shows the behavior you're seeing?

Frans Bouma | Lead developer LLBLGen Pro