Open ralmsdeveloper opened 6 years ago
Waiting for an example to reproduce the error.
hi.I've created a sample ASP Core + Angular 6 packeges included:
<ItemGroup>
<PackageReference Include="EntityFrameworkCore.FirebirdSql" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.1" />
</ItemGroup>
I've used firebird example EMPLOYEE.FDB (c:\Program Files\Firebird\Firebird_2_5\examples\empbuild) a simple model+configuration
namespace TEST.Models
{
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
public partial class Entities : DbContext
{
public virtual DbSet<EMPLOYEE> EMPLOYEE { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseFirebird("database = localhost:D:\\data_serv\\z.fdb;user=SYSDBA;password=masterkey");
}
protected override void OnModelCreating(ModelBuilder mB)
{
mB.Entity<EMPLOYEE>().HasKey(e => e.EMP_NO);
}
}
}
and
namespace TEST.Models
{
public partial class EMPLOYEE
{
public long EMP_NO { get; set; }
public string FIRST_NAME { get; set; }
}
}
in main controller
[HttpGet("[action]")]
public async Task<IActionResult> Res()
{
var res = await db.EMPLOYEE.Select(r=> new {NAME =r.FIRST_NAME }).ToListAsync();
return Ok(res);
}
all works with 2.1.1 after updating,not working entire project is here thanks
I did the tests using your example and I could not simulate your error. The .csproj information is:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<!-- Set this to true if you enable server-side prerendering -->
<BuildServerSideRenderer>false</BuildServerSideRenderer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EntityFrameworkCore.FirebirdSql" Version="2.1.2.2" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
<DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
</Project>
Follow the instructions and clear your cache and try again. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-locals
done.but the same error,tested on 2 computers thanks
I have the same problem. I don't have a test project, but I've tested in one of ours - build the assembly with debug information and attach to it (using current 2.1.2 branch). The exception is thrown because in FbQuerySqlGenerator(...) the _queryCompilationContex is null The exception is thrown when i try to login to a web app.
The interesting thing is: If i start the application, and try to login - the exception is thown. If I attach the Visual Studio to the process and try to login again - it breaks at line 59 in FbQuerySqlGenerator.cs because the _queryCompilationContext is null
But If i start the application without trying to login, attach the Visual Studio debugger to the process and Then try to login - it Works.
In my case everything depends when the debugger is attached.
Hi, was able to reproduce it with the latest version, does not appear within the 2.1.1.
CsProj
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EntityFrameworkCore.FirebirdSql" Version="2.1.2.2" />
</ItemGroup>
</Project>
DbContext
using Microsoft.EntityFrameworkCore;
namespace TestFirebirdEFCore.Entities
{
public class TestsContext : DbContext
{
private string _connectionString;
public TestsContext(string connectionString)
{
_connectionString = connectionString;
}
public virtual DbSet<TestEntity> TestEntities { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseFirebird(_connectionString);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TestEntity>(entity =>
{
entity.ToTable("TEST");
entity.HasKey(e => e.Id);
});
}
}
}
Test Entity
using System.ComponentModel.DataAnnotations.Schema;
namespace TestFirebirdEFCore.Entities
{
[Table("TEST")]
public class TestEntity
{
public int Id { get; set; }
}
}
Consumer
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using TestFirebirdEFCore.Entities;
namespace TestFirebirdEFCore
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please paste now the connection string");
var connectionString = Console.ReadLine();
using (var db = new TestsContext(connectionString))
{
Console.WriteLine("\tTests Count => " + db.TestEntities.Count()); // Object reference not set..
}
Console.ReadLine();
}
}
}
@souchprod, thanks for testing, I'll work on it today!
Hi,is that fixed? I see no new update,still 2.1.2.2 available.thanks
it is more than 4 months without a fix ... is that project dead?
@mrjohnr I want to apologize, I was involved in other projects of the company, I will start working on it .. as soon as possible ..
another month with no fix :(
another month with no fix :(
I also waited for a while... Then switched to: https://www.nuget.org/packages/FirebirdSql.EntityFrameworkCore.Firebird/
Hi,at this moment https://www.nuget.org/packages/FirebirdSql.EntityFrameworkCore.Firebird/ doesn't work with FB 2.5
It should at least to some point... I'm using it with FB 2.5.8 right now.
I'm using 2.5.8 too but not working with subselects
I have to apologize for the absence here, I'm involved with the company's projects, it took a lot of my time, I believed that someone in the community could help with this, but nobody built it, so what I have left and sacrifice in the next few days to update this repository in respect to all of you.
from @mrjohnr on 11 de set de 2018 09:26 BRT