动态调用停留在返回正确的EF实体列表的方法

时间:2018-08-10 06:10:01

标签: c# entity-framework-6 invoke

我有一个自定义报告应用程序,该应用程序正在升级以使用没有存储过程的EF 6.0。当用户单击列表中的预加载报表项时,代码将调用Invoke方法以运行与所选报表关联的方法并返回“对象”。每个方法都有一个定义的返回类型

例如(忽略bl ....):

git commit --amend

在这种情况下,我需要能够获取Invoke的返回对象并将其转换为返回类型(例如List)。然后将返回项放入报表的DataTable中。 “参与者”是EF实体,但在运行报告之前,我将不知道哪种类型。

这是到目前为止运行报告的方法:

@app.route("/")
@app.route("/home", methods=['GET', 'POST'])
def home():
    forms = SearchForm()
    if request.method == 'POST':
        print(forms.field_name.data) # <- prints to console.
        # to print to web convert to variable and render with jinja2
        # return render_template('display.html', field_name=forms.field_name.data)
    return render_template('home.html', title='Home', forms=forms)

这是我遇到问题的“ if(结果为IList && result.GetType()。IsGenericType {}”部分。If语句为true,但此后我一直被卡住。

这甚至可能吗?如果可以,我该如何完成我需要做的事情?

0 个答案:

没有答案