小编Cha*_*nas的帖子

尝试更新或删除商店中不存在的实体

我在使用 EF Core 3.x 和一对多导航属性时遇到了问题,而我在以前的版本中没有这些属性。

考虑以下代码:

public class Book
{

    public Book()
    {
        this.Id = Guid.NewGuid();
        this.Authors = new List<Author>();
    }

    public virtual Guid Id { get; protected set; }

    public virtual ICollection<Author> Authors { get; set; }

    public void AddAuthor(Author author)
    {
        author.BookId = this.Id;
        this.Authors.Add(author);
    }

}

public class Author
{

    public Author()
    {
        this.Id = Guid.NewGuid();
    }

    public virtual Guid Id { get; protected set; }

    public virtual Guid BookId { get; set; }

    public virtual Book …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework .net-core ef-core-3.0

8
推荐指数
1
解决办法
3685
查看次数

Kubernetes 上的 EventStore:连接被拒绝

我正在 .NET 5.0 中开发一个开源云事件网关,由 EventStore 通道提供支持,并且在连接 ProjectionsManager 服务时遇到了问题。

我在它自己的命名空间中部署了一个 EventStore 服务,并且可以成功连接到它,并订阅流。但是,当我尝试连接 ProjectionsManager 时,出现以下异常:

连接被拒绝 (eventstore.eventstore.svc.cluster.local:2113)

服务的完全限定名称“eventstore.eventstore.svc.cluster.local”正确且由 IEventStoreConnection 成功使用。端口 2113 也是正确的,因为我可以通过使用 Kubectl 将端口转发到该端口上的 pod 来访问管理 UI。

这是怎么回事?在我所有的本地和基于 docker-compose 的测试中,一切都按预期工作。只有在 Kubernetes 中我才会遇到这个问题。

这是我的 EventStore yaml 文件的内容:

apiVersion: v1
kind: Namespace
metadata:
  name: eventstore
  labels:
    name: eventstore

---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: eventstore
  namespace: eventstore
  labels:
    app: eventstore
spec:
  serviceName: eventstore
  replicas: 1
  selector:
    matchLabels:
      app: eventstore
  template:
    metadata:
      labels:
        app: eventstore
    spec:
      containers:
        - name: eventstore
          image: eventstore/eventstore:release-5.0.1
          imagePullPolicy: IfNotPresent …
Run Code Online (Sandbox Code Playgroud)

kubernetes istio .net-5 eventstoredb

6
推荐指数
1
解决办法
236
查看次数