我正在尝试使用LinqKit和expandable-extensions为我的底层数据库构建一些动态查询。
在我的代码中,我有一个看起来像
的属性google.charts.load('current', {
callback: function () {
var googleChart = new google.visualization.AreaChart(document.getElementById('chart_div'));
var googleData = null;
$('.buttonSala').click(getData);
$(window).resize(drawChart);
function getData() {
$('.error').hide();
var nome = $( "#nomeSala option:selected" ).val();
$('.box-title').html(nome);
var objeto = $( "#sensorSala option:selected" ).val();
var canal = $( "#canalSala option:selected" ).val();
var datai = $("#datainisala").val();
var dataf = $("#datafimsala").val();
var posting = $.post( "getSala.php", { canal: canal, dataini: datai, datafim: dataf, objeto: objeto } );
posting.done(processData);
return false;
}
function processData(data) {
var response = JSON.parse(data);
var jsonData = response.channels[canal].values;
var desciption = response.channels[canal].info.chname;
dataArray = [["ts", desciption ]];
for (var i = 0; i < jsonData.length; i++) {
dataArray.push([
jsonData[i].ts,
parseFloat(jsonData[i].value.replace(",", "."))
]);
}
var googleData = google.visualization.arrayToDataTable(
dataArray
);
drawChart();
}
function drawChart() {
if (googleData === null) {
return;
}
googleChart.draw(googleData, {
curveType: 'function',
backgroundColor: '#fff',
colors: ['#5d4a50'],
vAxis: {
gridlines: {
color: 'transparent'
},
textStyle: {
color: '#666',
fontSize: 16
}
},
legend: {
position: 'bottom',
textStyle: {
color: '#666', fontSize: 18
}
}
});
}
},
packages: ['corechart']
});
我称之为private Expression<Func<MyModel, MyConfig, MyResult>> Parent
{
get
{
var modelParam = Expression.Parameter(typeof(MyModel), "myModel");
var configParam = Expression.Parameter(typeof(MyConfig), "config");
var conditionalExpression = Expression.Call(configParam, typeof(MyConfig).GetMethod("ShowParent"), Expression.Constant("SomeName"));
// how to decide whether to return an expression or null?
// build expression or return constant null-expression
}
}
。
是否有机会获得对传递给Invoke调用的config-param的访问权,以确定getter内是否返回真实的Parent.Invoke(myModel, config)
或Expression
?
null
类有一个方法MyConfig
我想在getter中调用以确定要做什么?
这可能吗?如果没有,从哪里开始有什么好处?