Visual C#CLR项目错误

| 我有一个clr项目R,其中有一个名为RN的用户定义类型,RN看起来像
[Serializable]
[Microsoft.SqlServer.Server.SqlUserDefinedType(Format.UserDefined)]  
public struct RN: INullable, IBinarySerialize
{
    public SqlInt64 Id { get; set; }
    public SqlGeometry G { get; set; }
    public SqlInt64? CL { get; set; }
    public SqlDouble? TT { get; set; }

    public bool HP { get { return !Object.ReferenceEquals(this.CL, null); } }

    public RN ToClass(DataRow node); 

    public RN TN(DataRow node);
    public void P(SqlCommand command);

    public IEnumerable<RN> N;

    public override bool Equals(object obj);
    public bool Equals(RN other);
    public static bool operator ==(RN rn1, RN rn2);
    public static bool operator !=(RN rn1, RN rn2);
    public override int GetHashCode();

    public override string ToString();

    public bool IsNull;

    public static RN Null;

    public static RN FromId(SqlInt64 id);

    private bool m_Null;

    public void Write(System.IO.BinaryWriter w)
    {
        w.Write(this.IsNull);
        if (!this.IsNull)
        {
            w.Write(this.Id.Value);
            w.Write(this.G.STAsText().Value);
            bool CLNull = this.CL.HasValue;
            w.Write(CLNull);
            if (!CLNull)
                w.Write(this.CL.GetValueOrDefault(SqlInt64.MinValue).Value);
            bool TTNull = this.TT.HasValue;
            w.Write(TTNull);
            if (!TTNull)
                w.Write(this.TT.GetValueOrDefault(SqlInt64.MinValue).Value);
        }
    }
    public void Read(System.IO.BinaryReader r)
    {
        this.m_Null = r.ReadBoolean();
        if (!this.IsNull)
        {
            this.Id = r.ReadInt64();
            this.G = SqlGeometry.Parse(r.ReadString());
            bool CLNull = r.ReadBoolean();
            if (CLNull)
                this.CL = null;
            else
                this.CL = r.ReadInt64();
            bool TTNull = r.ReadBoolean();
            if (TTNull)
                this.TT = null;
            else
                this.TT = r.ReadInt64();
        }
    }
}
当我尝试作为测试部署项目时,我收到消息   部署错误SQL01268:.Net SqlClient   数据提供者:Msg 6244,级别16   状态1,行1的大小(0)为   \“ R.RN \”不在   有效范围。大小必须为-1或   1至8000之间的数字。 我不知道这意味着什么,对于任何想知道为什么我添加了Format.UserDefined并实现IBinarySerialise的人(如果类型为Format.Native的话),我会收到错误消息   部署错误SQL01268:.Net SqlClient   数据提供者:Msg 6223,级别16   状态1,线路1类型   \“ R.RN \”被标记为   本机序列化,但字段   \“ k__BackingField \”类型   \“ R.RN \”是类型   \“ Microsoft.SqlServer.Types.Microsoft.SqlServer.Types.SqlGeometry \”,   没有标记   \“ LayoutKind.Sequential \”。本机   序列化要求类型为   标有\“ LayoutKind.Sequential \”。 如果有人可以解释这些错误的含义以及如何解决这些错误,将不胜感激。 谢谢     
已邀请:
        结构具有the2ѭ的
SqlUseDefinedType
属性。在这种情况下,还必须指定MaxByteSize。 请参阅MSDN文档条目。     

要回复问题请先登录注册