Generating dbcontext with sqlmetal creates my table value UDF columns as nullable

417 Views Asked by At

I've created a inline table UDF which have some various columns of different types.

ALTER FUNCTION [dbo].[fnTest]()
RETURNS TABLE 
AS
RETURN 
(
    SELECT 
        [t0].[type], 
        [t0].[status], 
        [t0].[createdDate], -- datetime not null
        [t1].[ACLID]        -- bigint not null
    FROM 
        [dbo].[ProcessInstanceWorkitem] AS [t0] 
        INNER JOIN [dbo].[Object] AS [t1] ON [t0].[objectID] = [t1].[objectID] 
)

However, although some columns are set to not null sqlmetal.exe created them as nullable types:

public partial class FnTestResult
{

    private string _Type;

    private string _Status;

    private System.Nullable<System.DateTime> _CreatedDate;

    private System.Nullable<long> _ACLID;

...

Why doesn't it get the correct types which are not nullable?

I use sqlmetal (Microsoft (R) Database Mapping Generator 2008) version 4.0.30319.1 for .NET Framework version 4.

0

There are 0 best solutions below