I have Created a table like
CREATE TABLE [dbo].[tab1](
[Id] [int] NOT NULL,
[Name] [varchar](100) NOT NULL,
[Meta] [xml] NULL,
CONSTRAINT [PK_tab1] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
When I am doing linq to sql query to fetch a data it throw an error "data at the root level is invalid linq". In further investigation I come to know that the meta column is null in that case. In real it is nullable Do I have to remove the nullable and set some blank root node as default or there is some another way to get rid of the error.
My linq Query which throws error
var obj1= (from obj in dbContext.tab1s
where obj.id== 123
select obj).FirstOrDefault<Tab1>();