asp.net core2 and llblgen 5.3

Posts   
 
    
morten71
User
Posts: 80
Joined: 13-Jan-2009
# Posted on: 14-Oct-2017 22:44:22   

Problem fixed: I was missing the "RuntimeConfiguration.ConfigureDQE" in the Configure method in my StartUp class (see http://llblgen.com/Documentation/5.3/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_runtimeconfiguration.htm)

Original post: I trying to get a asp.net core 2 to work with a LLBLGen 5.3 generated data layer.

My steps: - generated a C# .NET standard 2.0 SelfServing project (Project.Db) - added Project.Db to the Project solution (website) - referenced Project.Db in Project - added SD.LLBLGen.Pro.DQE.SqlServer and SD.LLBLGen.Pro.ORMSupportClasses to Project via Nuget - added connection in Configure method in my StartUp class: RuntimeConfiguration.AddConnectionString("ConnectionString.SQL Server (SqlClient)", "data source=localhost\SQL2014;initial catalog=Project;integrated security=SSPI;persist security info=False;packet size=4096");

when running this code in a Controller:


var metaData = new LinqMetaData();
var entity = metaData.ShortId.SingleOrDefault(t => t.ShortId == shortId);

I'm getting this exception:

SD.LLBLGen.Pro.ORMSupportClasses.ORMGeneralOperationException occurred HResult=0x80131500 Message=DbProviderFactory information for compatibilitylevel SqlServer2005 wasn't properly initialized. Source=SD.LLBLGen.Pro.DQE.SqlServer StackTrace: at SD.LLBLGen.Pro.DQE.SqlServer.SqlServerSpecificCreator.ObtainDbProviderFactoryInfo(SqlServerCompatibilityLevel compatibilityLevel) at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateDbSpecificCreator() at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.CreateConnection(String connectionString) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.PerformGetMultiAction(ITransaction containingTransaction, QueryParameters parameters) at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider.ExecuteEntityProjection(QueryExpression toExecute) at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression, Type typeForPostProcessing) at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable1 source, Expression1 predicate) at Project.Controllers.HomeController.Index() in C:\Project\Controllers\HomeController.cs:line 28 at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()

What am I missing?

Thanks in advance.

Best regards Morten

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 15-Oct-2017 09:34:00   

Yes, you're not alone with running into that simple_smile We added a note to the docs for it even, but it's still not obvious, as on .net full people didn't have to register the factory.

Frans Bouma | Lead developer LLBLGen Pro