打开SqlFunction类,编写table-valued函数:
可复制代码:
[SqlFunction(DataAccess = DataAccessKind.None, FillRowMethodName = "FillRow_1A", TableDefinition = "Id TINYINT,Name NVARCHAR(30), [key] NVARCHAR(30)") ] public static IEnumerable Tvf_SiteInfor() { FruitEntity fe = new FruitEntity(); return fe.GetData(); } private static void FillRow_1A(object source, out SqlByte id, out SqlChars name, out SqlChars key) { Si obj = (Si)source; id = new SqlByte(obj.Id); name = new SqlChars(obj.Name); key = new SqlChars(obj.Key); }