在Linq中支持新的数据类型 [英] Supporting New DataType in Linq

查看:61
本文介绍了在Linq中支持新的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sqlserver中定义了一个新的数据类型(persiandate),
并创建一个新表,但是当我在c#2008中使用LINQ时,
和darg表出现以下错误消息:

一个或多个选定项包含的数据类型
设计器不支持.

I Define a new Datatype (persiandate) in my sqlserver,
and create a new table but when i use LINQ in c# 2008,
and darg table following error message appear:

one or more selected items contain a datatype that
is not supported by the designer.

How to define this new datatype for LINQ?

推荐答案

Hello

就像说的那样,不支持数据类型,也没有办法将其强制为EF.

MSDN

我更喜欢在数据库中将PersianDate用作nvarchar,然后在我的C#应用​​程序中将它们转换为PersianDate. (看看SA的建议,他是对的)

如果您在转换波斯语日期字符串时遇到任何问题,它可能会有所帮助:返回值并转换系统的PersianDate库.DateTime [ ^ ]
Hello

As it says the data type is not supported and no way to force it to EF.

MSDN

I prefer to use PersianDate as nvarchar in Database and Converting them to PersianDate in my C# application. (Look at SA''s suggestion, he''s right)

If you have any problem in converting persian date string maybe it helps: PersianDate Library that Returns value and Converts System.DateTime[^]


这篇关于在Linq中支持新的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆