展开时Breeze生成的查询中如何设置列名?

How to set up the column names in the query which is generated by Breeze in case of expand?

我有下面的数据库结构和 EF 上下文,我想查询博客条目。在这种情况下,博客条目表示 blog_entry(包括 id 和标题字段)和 blog_body,包括 body_with_markup 和 body_without_markup 字段。

我在 Breeze 中有一个查询,如下所示,结果是 服务器返回 500 错误,因为没有 'BlogBody_Id' 字段 。我找出了 breeze-ef 生成的查询,问题是在生成的查询中使用 'BlogBody_Id' 而不是 'Id'。我更改了查询中的列名,结果是我想要的结果。

在这种情况下我可以看到两个选项:

我的问题是关于第二个问题。如果可能的话我该怎么做?我浏览了文档,但没有找到与此问题相关的任何内容。

return EntityQuery.from('blogEntry')
                .select()
                .expand('blogBody')
                .using(newManager)
                .execute()
                .then(success)
                .catch(failed);

            function success(data) {
                console.log(data.results);
                return data.results;
            }

            function failed(msg) {
                console.log('error: ' + msg);
            }
CREATE TABLE [dbo].[BLOG_ENTRY](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [TITLE] [nvarchar](255) NOT NULL,
    [IS_PUBLISHED] [int] NOT NULL DEFAULT ((0)),
    [AUTHOR_ID] [int] NOT NULL DEFAULT ((1)),
    [CREATE_DATE] [datetimeoffset](7) NOT NULL DEFAULT (getdate()),
    [CREATED_BY] [int] NOT NULL DEFAULT ((1)),
    [LAST_CHANGED_DATE] [datetimeoffset](7) NOT NULL DEFAULT (getdate()),
    [LAST_CHANGED_BY] [int] NOT NULL DEFAULT ((1)),
 CONSTRAINT [PK_dbo.BLOG_ENTRY] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 75) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[BLOG_BODY](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [BODY_WITH_MARKUP] [text] NOT NULL,
    [BODY_WITHOUT_MARKUP] [text] NULL,
    [BLOG_ENTRY_ID] [int] NOT NULL,
    [CREATE_DATE] [datetimeoffset](7) NOT NULL DEFAULT (getdate()),
    [CREATED_BY] [int] NOT NULL DEFAULT ((1)),
    [LAST_CHANGED_DATE] [datetimeoffset](7) NOT NULL DEFAULT (getdate()),
    [LAST_CHANGED_BY] [int] NOT NULL DEFAULT ((1)),
 CONSTRAINT [PK_dbo.BLOG_BODY] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 75) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

ALTER TABLE [dbo].[BLOG_BODY]  WITH CHECK ADD  CONSTRAINT [FK_dbo.Blog_Body__Blog_Entry_Id] FOREIGN KEY([BLOG_ENTRY_ID])
REFERENCES [dbo].[BLOG_ENTRY] ([ID])
public class BlogEntry
    {
        public int Id { get; set; }

        [Required]
        [StringLength(255, MinimumLength = 3)]
        public string Title { get; set; }

        [Required]
        public int IsPublished { get; set; }

        public BlogBody BlogBody { get; set; }
    }

public class BlogBody
    {
        public int Id { get; set; }

        public string BodyWithMarkup { get; set; }

        public string BodyWithoutMarkup { get; set; }

        public int BlogEntryId { get; set; }
    }

问题的根源不在 breeze 端,而是 objects 之间没有外键注释。我设置了 objects 之间的关系,现在它工作正常。