Create Proc usp_SelectSomething
@Column1 int,
@Column2 varchar(255)
As
Select * From Table
Where Column1 = @Column1 AND Column2 = @Column2
Go
這樣的話在C# EF 取就會是public ObjectResult但是這樣就沒辦法應對 WHERE col IN(...) 的應用,因為無法動態產生不定數量的參數。sp_SelectSomething(global::System.Int32 column1, global::System.String column2) { ... } _MyDbEntitie.usp_SelectSomething(column1, column2);