[英]ASP.NET/C# - Entity Framework - Classes - Skeleton Method
I currently have a Class which uses the function as such: 我目前有一个使用该函数这样的类:
var txbl = test.search_bustype("SUP", "Name");
or 要么
foreach(string toWorkWith in test.search_bustype("SUP", "Name")){ // each one }
However, for every Column I want to search using a function, I have to create a separate function. 但是,对于要使用函数搜索的每个列,我必须创建一个单独的函数。
ie: Columns - bustype, companyID - Would have to have separate functions to search. 即:列-bustype,companyID-必须具有单独的搜索功能。
My current code is: 我当前的代码是:
public Array search_bustype(string match, string forthat)
{
db = new rkdb_07022016Entities2();
var tbl = (from c in db.tblbus_business select c).ToArray();
List<string> List = new List<string>();
int i = 0;
foreach (var toCheck in tbl)
{
if (toCheck.BusType.ToString() == match)
{
if (forthat == "Name")
{
List.Add(toCheck.Name);
}
}
i++;
}
return List.ToArray();
}
Is there anyway to possibly, like php
actually send the query
to the function and then run it there? 无论如何,有可能像
php
实际上将query
发送到函数然后在其中运行它? I haven't been able to find many sources about how to build a secure infrastructure with Entity so I am wondering if anyone knows any way of maybe creating a skeleton
method with this framework. 我没有找到许多有关如何使用Entity构建安全基础结构的资源,因此我想知道是否有人知道使用此框架创建
skeleton
方法的任何方法。
Thanks in advance! 提前致谢!
Okay so I stumbled on the Frameworks sources and actually now understand that the Framework itself implements the Skeleton
method. 好的,所以我偶然发现了Frameworks的源代码,现在实际上了解到Framework本身实现了
Skeleton
方法。
You simply only refer to each query inside the (from c in......
您只需简单地引用
(from c in......
I'll have to look further into how this infrastructure works before I can understand how to further implement functions. 在理解如何进一步实现功能之前,我将不得不进一步研究该基础结构的工作方式。
Thank-you for your time however! 谢谢您的宝贵时间! I will close this.
我将关闭这个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.