Breeze 未找到附加属性密钥

Breeze 未找到附加属性密钥,breeze,breeze-sharp,Breeze,Breeze Sharp,我正在用Breezesharp实现一个应用程序。在EntityManager中插入实体时遇到问题。错误是: EntityType:“TransportReceipt:#Business.DomainModels”上尚未定义KeyProperties 我已经在我的第一个实体类型“Customer”中遇到了这个错误,并按照建议实现了一种不匹配的方法。在这种情况下,我成功地对我的WebApi执行了get操作。但现在我正在应用程序中创建TransportReceipt实体 映射不匹配修复 public

我正在用Breezesharp实现一个应用程序。在EntityManager中插入实体时遇到问题。错误是:

EntityType:“TransportReceipt:#Business.DomainModels”上尚未定义KeyProperties

我已经在我的第一个实体类型“Customer”中遇到了这个错误,并按照建议实现了一种不匹配的方法。在这种情况下,我成功地对我的WebApi执行了get操作。但现在我正在应用程序中创建TransportReceipt实体

映射不匹配修复

public static class ExtendMap
{
    private static bool? executed;
    public static void Execute(MetadataStore metadataStore) {
        if (ExtendMap.executed == true)
        {
            return;
        }

        var customerBuilder = new EntityTypeBuilder<Customer>(metadataStore);
        customerBuilder.DataProperty(t => t.id).IsPartOfKey().IsAutoIncrementing();

        var transportReceiptBuilder = new EntityTypeBuilder<TransportReceipt>(metadataStore);
        transportReceiptBuilder.DataProperty(t => t.id).IsPartOfKey().IsAutoIncrementing();

        var transportReceiptAttachmentBuilder = new EntityTypeBuilder<TransportReceiptAttachment>(metadataStore);
        transportReceiptAttachmentBuilder.DataProperty(t => t.id).IsPartOfKey().IsAutoIncrementing();

        var uploadedFileBuilder = new EntityTypeBuilder<UploadedFile>(metadataStore);
        uploadedFileBuilder.DataProperty(t => t.id).IsPartOfKey().IsAutoIncrementing();

        ExtendMap.executed = true;
    }
}
这就是我试图添加新实体的人

//DataService snippet
 public void AttachEntity(T entity)
    {
        this.EntityManager.AttachEntity(entity, EntityState.Added);
    }

//Business
 this.TransportReceipt = new TransportReceipt { id = Guid.NewGuid(), date = DateTime.Now, customerId = Customer.id/*, customer = this.Customer*/ };
            this.Attachments = new List<TransportReceiptAttachment>();
            this.TransportReceipt.attachments = this.Attachments;
            TransportReceiptDataService.AttachEntity(this.TransportReceipt);
//数据服务片段
公共无效附件(T实体)
{
this.EntityManager.AttachEntity(entity,EntityState.Added);
}
//生意
this.transportReceivement=new-transportReceivement{id=Guid.NewGuid(),date=DateTime.Now,customerId=Customer.id/*,Customer=this.Customer*/};
this.Attachments=新列表();
this.TransportReceipt.attachments=this.attachments;
TransportReceiptDataService.AttachEntity(此为TransportReceipt);
当我尝试将实体添加到EntityManager时,我可以看到所有实体类的自定义映射。

所以我的问题是我做错了什么。

好的。真奇怪

我更改了一个新的伪int属性的映射,并且可以正常工作。我将很快测试整个存储流,并在这里分享结果

更新

我继续前进,开始移除Breezezharp。Breezesharp项目不是最新的,并且与Xamarin没有很好的集成。如果您有任何评论,我将不胜感激。

好的。真奇怪

我更改了一个新的伪int属性的映射,并且可以正常工作。我将很快测试整个存储流,并在这里分享结果

更新


我继续前进,开始移除Breezezharp。Breezesharp项目不是最新的,并且与Xamarin没有很好的集成。如果您有任何意见,我将不胜感激。

问题是因为我使用非Breezesharp模式创建了实体类。这个问题是因为我使用not模式创建了实体类。GetValue,SetValue。
//DataService snippet
 public void AttachEntity(T entity)
    {
        this.EntityManager.AttachEntity(entity, EntityState.Added);
    }

//Business
 this.TransportReceipt = new TransportReceipt { id = Guid.NewGuid(), date = DateTime.Now, customerId = Customer.id/*, customer = this.Customer*/ };
            this.Attachments = new List<TransportReceiptAttachment>();
            this.TransportReceipt.attachments = this.Attachments;
            TransportReceiptDataService.AttachEntity(this.TransportReceipt);