1

我正在测试 C# 和 Restier 库。和很多人一样,我尝试公开一个人的实体框架模型的“FullName”属性,而Restier 拒绝公开它。

public partial class User
{
        public User()
        {
        }

        public int id { get; set; }
        public string lastName { get; set; }
        public string firstName { get; set; }
        public fullName // not visible
        {
               get { return lastName + " " + firstName; }
        }
}

我在这篇文章中看到,使用 DelegateDecompiler 应该是可能的,而不会因为丑陋的 sql 查询而失去性能。
链接:
https ://daveaglick.com/posts/computed-properties-and-entity-framework
https://github.com/hazzik/DelegateDecompiler

我安装了它并写道:

[NotMapped]
[Computed]
public string fullName
{
     get { return firstName + " " + lastName; }
}

但是我不能让它工作,该属性仍然没有暴露给 API。
我错过了什么?
谢谢

4

0 回答 0