You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have table valued functions which have nullable parameters. But the generator generates parameters' values with GetValueOrDefault function not DBNull.Value. So if the function has int? parameter, and its value is null, then it creates function query using "0" not "NULL". So I've changed generator code like this:
public static readonly Func<StoredProcedure, string> WriteTableValuedFunctionDeclareSqlParameter = sp =>
{
var sb = new StringBuilder();
foreach (var p in sp.Parameters.OrderBy(x => x.Ordinal))
{
sb.AppendLine(string.Format(" var {0}Param = new System.Data.Entity.Core.Objects.ObjectParameter(\"{1}\", typeof({2})) {{ Value = (object){3} }};",
p.NameHumanCase,
p.Name.Substring(1),
p.PropertyType,
p.NameHumanCase + (p.Mode == StoredProcedureParameterMode.In && NotNullable.Contains(p.PropertyType.ToLowerInvariant()) ? string.Empty : " ?? System.DBNull.Value/*.GetValueOrDefault()*/" )));
}
return sb.ToString();
};
Is this a bug or am I doing wrong somewhere?
The text was updated successfully, but these errors were encountered:
Hi,
I have table valued functions which have nullable parameters. But the generator generates parameters' values with
GetValueOrDefault
function not DBNull.Value. So if the function has int? parameter, and its value is null, then it creates function query using "0" not "NULL". So I've changed generator code like this:Is this a bug or am I doing wrong somewhere?
The text was updated successfully, but these errors were encountered: