I have a blazor project. I want to call a method in .net standard (grabMbsaMember). This method calls a method in my framework 4.7.2 (GetMemberById). This method should return member data (customer) information back to .net standard, and then to my blazor project.
Here is my configuration :
This is from my blazor project :
This is from my .net framework 4.7.2
This is my EF installed on my .net framework 4.2.7 .
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
This is my .net standard 2.0
My blazor project calls this method in .net standard:
This is the method in .net standard: grabMbsaMember
This is the application config (appsettings.json in my blazor application). the error method
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
//20220718 RC@2021102008b added connection string
//20221013 - RC@2021102008g added MBSAnalysisData
"AllowedHosts": "*",
"ConnectionStrings": {
"MbsaDataEntities": "Data Source=IQWORKS120\MSSQLSERVER2012;Initial Catalog=MBSAnalysisData;User Id = eflogin;Password=eflogin;Integrated Security=True;",
"default": "Data Source=IQWORKS120\MSSQLSERVER2012;Initial Catalog= MBSAnalysisData ;User Id = eflogin;Password=eflogin;Integrated Security=True;"
}
}
This is the method in my .net 4.7.2 I am calling from .net standard. This should return a members information from the .net 4.7.2 entity framework 6.0.0.0.
This is the error I get …
blazor.server.js:1 [2022-10-17T18:54:39.169Z] Error: System.InvalidOperationException: No connection string named 'MbsaDataEntities' could be found in the application config file.
at System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.Initialize()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.Where[TSource](IQueryable
1 source, Expression`1 predicate)
at Mbsa.BL.MembersService.GetMemberById(Int32 id) in D:\MBSSys\Mbsa\Mbsa 2021\BL\MembersService.cs:line 902
at MbsaDotNetStandard.MbsaUseFrameworkMethods.grabMbsaMember(Int32 mno) in D:\MBSSys\MbsaDotNetStandard\MbsaUseFrameworkMethods.cs:line 17
at MbsaBlazorServerSideEF.Pages.MbsaMemberPage.OnInitializedAsync() in D:\MBSSys\MbsaBlazorServerSideEF\Pages\MbsaMemberPage.razor:line 90
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)