I have an Stored Procedure in 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
Definition of Email Table:
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)),
And EntityFramework model in C#. Whenever I right-click in Visual Studio Model Browser to this EntityFramework model and choose the menu "Update Model from Database", the model gets updated, but the field MailTo in GetEmailThread_Result is always missing.
I need to add it manually to the model GetEmailThread_Result.cs to get it working.
Why? Why this? I cannot see anything special in this field. Why not MailFrom?
解决方案是在损坏的项目中手动编辑EF文件,有关详细信息,请参阅更新实体框架模型。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.