![](/img/trans.png)
[英]Npgsql C# problem with App.Config PostgreSQL Entity Framework 6
[英]C# missing method in Npgsql Entity Framework
当我尝试运行以下行时出现错误:
FlowsQuerieStartDate tmp = context.FlowsQuerieStartDates
.FirstOrDefault(x =\> x.Client.Equals(connectionToSQLDatabase.ClientName));
FlowsQuerieStartDate tmp =
context.FlowsQuerieStartDates.FirstOrDefault(x => x.Client.Equals(connectionToSQLDatabase.ClientName));
异常文本是:
'找不到方法:'System.Collections.Generic.IEnumerable`1<Npgsql.TypeMapping.NpgsqlTypeMapping> Npgsql.TypeMapping.INpgsqlTypeMapper.get_Mappings()'。
这是映射类:
using Microsoft.EntityFrameworkCore;
using System;
namespace PostgreSQL.FlowQueryStartDate
{
public class FlowsQuerieStartDateContext : DbContext
{
public DbSet<FlowsQuerieStartDate> FlowsQuerieStartDates { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("constring");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<FlowsQuerieStartDate>(entity =>
{
entity.ToTable("FlowsQuerieStartDate", "public");
entity.Property(e => e.Client).HasColumnName("Client");
entity.Property(e => e.StartDate).HasColumnName("StartDate");
entity.HasNoKey();
});
}
}
public class FlowsQuerieStartDate
{
public string Client { get; set; }
public DateTime StartDate { get; set; }
}
}
.NET 框架 4.7.2
Microsoft.EntityFramework 版本 3.1.3
Npgsql 版本 6.0.3
Npsql.EntityFramework.PostgreSQL 版本 3.1.0
有什么建议吗? 这让我大吃一惊……
对我有用的是:
如果这对您不起作用,可以在以下链接上找到关于该主题的讨论: https ://github.com/elsa-workflows/elsa-core/issues/2544
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.