【发布时间】:2015-03-25 15:14:02
【问题描述】:
我在 sql (msql-server) 中使用nvarchar 数据类型来描述描述。
但我想将该列更改为 xml 数据类型。
在我的 c# 数据层中,我使用 petapoco 来获取数据,该数据使用 Ado.Net DataReader。
所以
poco 对象:
[PetaPoco.TableName("sqlTableName")]
[PetaPoco.PrimaryKey("ID")]
public class PlainObj
{
public int ID { get; set; } //(int, not null)
public string Description { get; set; } //(string, null) want to change this to xml type
}
poco 获取方法
public static List<PlainObj> Get(int InId)
{
var s = PetaPoco.Sql.Builder.Append(";EXEC @0", Common.StoreProcs.GetSP);
s.Append("@@ID = @0", new SqlParameter() { SqlDbType = SqlDbType.Int, Value = InId });
return PetaPocoContext.Fetch<PlainObj>(s); //Gets the object
}
我的问题是,如何获取 XML 而不是描述字符串,PetaPoco 是否支持它。
【问题讨论】:
标签: c# sql-server ado.net petapoco