Sql Columns Defined As Nvarchar(1) |
![]() ![]() |
Sql Columns Defined As Nvarchar(1) |
May 19 2009, 10:34 AM
Post
#1
|
|
|
|
Not sure whether this is part of LinqPad or the Framework, but if you have a Sql table with a column of type NVarChar and length 1, then it is mapped to char? instead of string? which causes a problem if the column contains an empty string.
Is there a way of fixing this? |
|
|
|
May 19 2009, 06:54 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 207 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
Good point. LINQPad maps char(1) columns to a char type from version 1.35 to be consist with SqlMetal and Visual Studio's designer.
You can disable this in Edit | Preferences | Query although this will disable support for 1:1 relationships as well. Perhaps I should decouple these two things in the next update. Joe |
|
|
|
May 21 2009, 12:30 AM
Post
#3
|
|
|
|
Good point. LINQPad maps char(1) columns to a char type from version 1.35 to be consist with SqlMetal and Visual Studio's designer. You can disable this in Edit | Preferences | Query although this will disable support for 1:1 relationships as well. Perhaps I should decouple these two things in the next update. Joe Thanks. If you could decouple them it would be great as the 1:1 relationships is too nice a feature to lose. |
|
|
|
Jul 12 2009, 10:06 PM
Post
#4
|
|
|
|
That was really a great post and information - just bookmarked and keep up the good work
-------------------- |
|
|
|
Jul 13 2009, 04:53 AM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 207 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
You might like to download the latest preview of LINQPad:
http://www.linqpad.net/preview/LINQPad.exe I've permanently disabled the mapping of nvarchar(1) to char - it now maps to string instead. nchar(1) and char(1) however, still map to the char type. This should take care of nearly all scenarios. Joe |
|
|
|
Jul 15 2009, 05:43 AM
Post
#6
|
|
|
|
You might like to download the latest preview of LINQPad: http://www.linqpad.net/preview/LINQPad.exe Yes, that works fine. Thank you very much. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 7th November 2009 - 05:52 PM |