I am using the below scripting functoid in the biztalk map to convert the string in to DateTime
public DateTime? ConvertOpenDate(string openDate)
{
DateTime oDate;
if (!DateTime.TryParseExact(openDate, "yyyy-MM-DD HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out oDate))
{
return null;
}
else
{
return oDate;
}
}
But it is throwing error saying
Extension functions cannot return null values.
How to handle this. I am inserting the datetime in to MS SQL DB
解决方案
So, let me say, this is making this way more complicated then it needs to be.
I explained exactly what you need to do in the other thread. Using an extension method really doesn't get you anything.
All you need to do is return the 'o' format to fill an xs:datetime field in the SQL Schema.
这篇关于扩展函数不能返回空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!