Задайте вопросЗадайте вопрос
 

ОтвеченоBug in nvarchar(1) conversion in DataContext designer

  • 8 января 2009 г. 0:51Javier Campos Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     
    Hello all,

    I have some tables which use nvarchar(1) nullable fields. This gets translated on the LINQ entity (using the Visual Studio generator and dragging a table from the server explorer to the datacontext) to nullable char ("char?") properties for the entities, which might look correct at first glance, however, nvarchar(1) allows for empty strings, which char? doesn't, and LINQ will choke on any query with such field data.

    The workaround is a matter of making it a System.String on the entity, but it should be noted that nvarchar(1) entities are not necessarily one char in length or null (they can contain empty strings). In my application (made in Delphi, and currently making a port over to ASP.NET) this has caused a bunch of headaches, since some of those fields do mean different things with empty and null data for the application.

    Don't know if this should go on this forum though, it's not a bug with Linq per-se, but rather with the DataContext designer (and maybe SQL Metal? haven't tried it)

    Before I speak, I have something important to say.

Ответы

Все ответы