我试图在VS 2013中抽象自动生成的ODataController类,因为除了POCO的名称之外,代码在不同的控制器中看起来相同,所以,我做了以下内容:
public abstract class ODataControllerBase<T,DB> : ODataController
where T : class, IIdentifiable, new()
where DB : DbContext, new()
{
protected DB _DataContext;
public ODataControllerBase() : base()
{
_DataContext = new DB();
}
// only one function shown for brevity
[Queryable]
public SingleResult<T> GetEntity([FromODataUri] int key)
{
return SingleResult.Create(_DataContext.Set<T>().Where(Entity => Entity.Id.Equals(key)));
}
}
Run Code Online (Sandbox Code Playgroud)
IIdentifiable
是一个强制T参数具有可读/可写Id整数属性的接口.
实现看起来像这样(POCO和DataContexts应该已经创建)
public class MyObjectsController : ODataControllerBase<MyObject,MyDbContext>
{
public MyObjectsController() : base()
{
}
// That's it - done because all the repetitive code has been …
Run Code Online (Sandbox Code Playgroud) 如何从 umbraco mvc 中的表面控制器添加查询字符串。这是我目前的代码。
最初我写了一个代码
public ActionResult Registration(RegisterModel model)
{
//Code to insert register details
ViewBag.Success="Registered Successfully"
return CurrentUmbracoPage();
}
Run Code Online (Sandbox Code Playgroud)
有了这个,我可以成功地保留我的 ViewBag 和模型属性值,但我无法用它添加查询字符串。
对于某些要求,我必须更改返回带有查询字符串的 url 的代码。我做了如下
public ActionResult Registration(RegisterModel model)
{
//Code to insert register details
ViewBag.Success="Registered Successfully"
pageToRedirect = AppendQueryString("success");
return new RedirectResult(pageToRedirect);
}
public string AppendQueryString(string queryparam)
{
var pageToRedirect = new DynamicNode(Node.getCurrentNodeId()).Url;
pageToRedirect += "?reg=" + queryparam;
return pageToRedirect;
}
Run Code Online (Sandbox Code Playgroud)
有了这个,我的模型中的属性值无法持久化,并且 ViewBag 返回空值。
任何人都可以建议我如何通过将值保留在模型和 ViewBag 中来添加查询字符串。
我有以下蜡烛
+----------------+-------+----------+---------+----------+
|date |curency|high_price|low_price|last_price|
+----------------+-------+----------+---------+----------+
|2014-01-16 16:07|2 |24.98 |23.9 |24.2 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:06|2 |24.98 |23.9 |24.12202 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:05|2 |24.98 |23.9 |24.12202 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:04|2 |24.98 |23.9 |24.21626 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:03|2 |24.98 |23.9 |24.11102 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:02|2 |24.98 |23.9 |24.21628 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:01|2 |24.98 |23.9 |24.2 |
+----------------+-------+----------+---------+----------+
|2014-01-16 16:00|2 |24.98 |23.9 |24.2 |
+----------------+-------+----------+---------+----------+
Run Code Online (Sandbox Code Playgroud)
我使用 TA-lib 计算 Ema 如下
public MovingAverage CalculateEMA(List<OHLC> candles, int periodsAverage)
{
double[] closePrice = candles.Select(x => (double)x.last_price).ToArray();
double[] …
Run Code Online (Sandbox Code Playgroud) 我需要在这个小提琴上添加2个div
当我添加它它不起作用..它显示下面的文本和evrything是错误的.你知道如何添加2个选项吗?
$(document).ready(function () {
$('#div1,#div2').hide();
$('#id_radio1').click(function () {
$('#div2').hide('fast');
$('#div1').show('fast');
});
$('#id_radio2').click(function () {
$('#div1').hide('fast');
$('#div2').show('fast');
});
});
Run Code Online (Sandbox Code Playgroud) static void Main(string[] args)
{
if (args[0].ToUpper().Equals("DOWNLOADPOS"))
{
DownloadPOS();
}
Run Code Online (Sandbox Code Playgroud)
将运行DownloadPOS(),如果args中的第一项是downloadpos,我想检查args中的所有项目?请指教?
我以前用过:
//if (args.Contains(pos))
//{
// DownloadPOS();
//}
Run Code Online (Sandbox Code Playgroud)
但后来不确定如何确定它上面
谢谢
asp.net ×2
asp.net-mvc ×2
c# ×2
financial ×1
javascript ×1
jquery ×1
odata ×1
umbraco ×1
umbraco6 ×1