我在SQL Server 2012中有一个存储过程:
CREATE procedure [dbo].[GetEmailThread]
(
@id int
)
AS
SELECT e.Id, e.Created, e.MailFrom, e.MailTo, e.Body, e.Sended, ip.Ip, e2.Sended as ReplySended, e2.Body as ReplyBody, e2.Id as ReplyId
FROM Emails e
LEFT JOIN IpAddress ip ON (ip.Id = e.IpId)
LEFT JOIN Emails e2 ON (e.Id = e2.ParentEmailId)
WHERE e.RealtyId = @id
ORDER BY e.Sended, ReplySended
电子邮件表的定义:
CREATE TABLE [dbo].[Emails](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Created] [datetime] NOT NULL,
[MailFrom] [nvarchar](100) NOT NULL,
[MailTo] [nvarchar](500) NOT NULL,
[Subject] [nvarchar](500) NULL,
[Body] [nvarchar](max) NULL,
[Sended] [datetime] NULL,
[Ip] [varchar](15) NULL,
[ReplyTo] [nvarchar](100) NULL,
[IpId] [int] NULL,
[RealtyId] [int] NULL,
[ParentEmailId] [int] NULL,
[IsBodyHtml] [bit] NOT NULL CONSTRAINT [DF_Emails_IsBodyHtml] DEFAULT ((0)),
C#中的EntityFramework模型。每当我在Visual Studio模型浏览器中右键单击此EntityFramework模型并选择菜单"从数据库更新模型"时,模型会更新,但GetEmailThread_Result中的字段MailTo始终缺失。
我需要手动将其添加到模型GetEmailThread_Result.cs以使其正常工作。
为什么呢?为什么这个?我在这个领域看不到什么特别的东西。为什么不MailFrom?