有没有办法禁用或阻止实体框架在复杂类中创建 Nullable 属性?
例如,当我向实体框架添加一个新的存储过程时,它会生成一个如下所示的类。
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StorefrontSystemDL
{
using System;
public partial class proc_InsertLeafHorizontal_Result
{
public Nullable<int> SizeID { get; set; }
public Nullable<int> FinishID { get; set; }
public Nullable<int> SitelineID { get; set; }
}
}
我怎么能,我可以,或者是否有一个设置可以设置为实体框架不创建具有 Nullable 类型的属性的位置
下面是源列的快照。
对于我的存储过程,这里是 tsql 的主体
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRAN
BEGIN TRY
EXEC Storefront.proc_InsertHorizontal @Position,@Name,@Floor,@IsFiller,
@WidthInches,@HeightInches,@WidthPercent,@HeightPercent,
@DayliteWidthInches,@DayliteHeightInches,
@Finish,@FinishNote,@FinishType,@FinishName,
@ComponentID,@Note,
@HorizontalID OUT;
IF(@HorizontalID IS NOT NULL)
INSERT INTO [StorefrontSystem].[Storefront].[LeafHorizontal]
([LeafID]
,[HorizontalID])
VALUES
(@LeafID,
@HorizontalID)
----
SELECT h.SizeID,h.FinishID,h.SitelineID FROM Storefront.Horizontal h WHERE h.ID = @HorizontalID;
COMMIT TRAN
END TRY
BEGIN CATCH
ROLLBACK TRAN;
END CATCH
SET NOCOUNT OFF;
END;