我在Python中使用Facebook Graph API.每个帖子都有两个日期时间:
created_dateupdated_date当我提供since参数时,它返回created_date大于或等于since参数的feed .例如,如果我提供, since=2015-06-05那么它将从2015年6月5日到现在返回所有帖子.
但是假设有一个帖子在2015年6月7日发布,并且在2015年6月8日发生了很少的活动(喜欢,分享,评论等).在这种情况下updated_time,该帖子的更改但created_time将是相同的(第7次) 2015年6月).如果我传递参数since=2015-06-08,那么我将无法跟踪该帖子上的所有活动.
是否有任何解决方案可以通过它传递since参数updated_time而不是传递给它created_time?
是否可以在 ASP.NET Core 2.1 Razor 页面中刷新视图组件?
我发现这在使用 AJAX 的 ASP.NET MVC 中是可能的 - 请参阅Viewcomponent 替代解决方案,用于 ajax 刷新和ViewComponents 不是 async。但是 ASP.NET Core 呢?
我发现的一种解决方案基本上是让控制器返回视图组件,然后使用 AJAX 进行刷新。
这是从ViewComponents借来的例子不是异步的
~/HelloWorldViewComponent.cs
public class HelloWorldViewComponent : ViewComponent
{
public IViewComponentResult Invoke()
{
var model = new string[]
{
"Hello", "from", "the", "view", "component."
};
return View("Default", model);
}
}
Run Code Online (Sandbox Code Playgroud)
~/HomeController.cs(我无法让这部分在剃刀页面中工作)
public class HomeController : Controller
{
public IActionResult GetHelloWorld()
{
return ViewComponent("HelloWorld");
}
}
Run Code Online (Sandbox Code Playgroud)
~/Views/Shared/Components/HelloWorld/Default.cshtml …
ajax asp.net-mvc asp.net-core razor-pages asp.net-core-viewcomponent
看来在 ASP.NET Core MVC 中,如果我想使用视图组件,我必须将它们放入Views\\Shared\\Components\\[ViewComponentName],然后将文件命名为“Default.cshtml”。
这是相当令人沮丧的,因为在一个大型项目的开始,我正在帮助从 Perl CGI 进行移植,我正在创建大量的视图组件,并在 Visual Studio 中拥有五个选项卡,全部命名为Default.cshtml是令人困惑的。
有什么办法可以避免这种命名约定吗?也许甚至可以将它们从文件夹中取出,以便文件看起来像\xe2\x80\xa6?
\nViews\\Shared\\Components\\[ViewComponentName].cshtml\nRun Code Online (Sandbox Code Playgroud)\n我不知道是否只有一些设置可以调整或者什么。大多数情况下,我对 ASP.NET 非常陌生,并且仍在摸索中。使用 ASP.NET Framework 而不是 ASP.NET Core一种选择,但我不想这样做,因为很多样板已经完成。
\nViewComponents 的文档是这样说的:
\n\n\n我们建议您将视图文件命名为 Default.cshtml 并使用 Views/Shared/Components/{View Component Name}/{View Name} 路径。
\n
这让我认为有一种方法可以绕过这个限制,但它没有具体说明它是如何工作的或者它会是什么样子。
\nasp.net-core-mvc asp.net-core asp.net-core-viewcomponent view-components
我正在尝试使用 ASP.NET Core 3.0 和 Entity Framework 6 在 Razor 页面上使用复合键对实体进行删除操作。有问题的实体是一个CourseAssignment复合键由一个InstructorID值和一个CourseID值组成的实体.
对于具有普通单字段键的Course实体(例如具有CourseID主键的实体),razor 页面上的代码是这样的:
<form method="post">
<input type="hidden" asp-for="Course.CourseID" />
<input type="submit" value="Delete" class="btn btn-danger" /> |
<a asp-page="./Index">Back to List</a>
</form>
Run Code Online (Sandbox Code Playgroud)
这会产生这样的 URL: https://localhost:44388/Courses/Delete?id=1045
对此起作用的 C# 代码是:
<form method="post">
<input type="hidden" asp-for="Course.CourseID" />
<input type="submit" value="Delete" class="btn btn-danger" /> |
<a asp-page="./Index">Back to List</a>
</form>
Run Code Online (Sandbox Code Playgroud)
如何更改 razor 页面和 C#OnPostAsync操作以处理具有需要两个值的复合键的实体?
谢谢!
c# entity-framework-6 asp.net-core razor-pages asp.net-core-3.0
我刚刚尝试了新的C# 8 Nullable Reference Type,它允许我们使用不可为空的字符串。
在我的.csproj(.NET Core 3.1) 中,我设置了这个:
<Nullable>enable</Nullable>
Run Code Online (Sandbox Code Playgroud)
我创建了一个FooClass如下:
public class FooClass
{
public FooClass(string testString, DateTime testDate)
{
if (testString == null || testString == string.Empty)
throw new ArgumentNullException(nameof(testString));
else if (testDate == null)
throw new ArgumentNullException(nameof(testDate));
MyString = testString;
MyDate = testDate;
}
public string MyString { get; }
public DateTime MyDate { get; }
}
Run Code Online (Sandbox Code Playgroud)
但是,当我故意在我的类中创建一个Main()带有null值的新实例时:
var test = new FooClass(testString:null, testDate:null);
Run Code Online (Sandbox Code Playgroud)
编译器对testString参数没问题,但 …
我正在尝试从 Fluttericons.com 导入自定义图标。我得到一个带有 X 的框,而不是如图所示的图标。我已经包含了pubspec.yamlFluttericons.com 提供的我的 dart 文件。


这是给我的 Fluttericons.com 文件。我尝试删除它,_kFontPkg但没有成功。
import 'package:flutter/widgets.dart';
class MyIcons {
MyIcons._();
static const _kFontFam = 'MyIcons';
static const _kFontPkg = null;
static const IconData access_alarm = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}
Run Code Online (Sandbox Code Playgroud)
name: MyGymPro
description: Flutter fitness application
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_icons:
percent_indicator: "^2.1.1"
pedometer: ^1.0.0
intl: ^0.16.1
auto_size_text: ^2.1.0
shared_preferences: any
http: ^0.12.0+4
font_awesome_flutter: ^8.4.0
decimal: ^0.3.3
image_picker: ^0.6.4
mime: ^0.9.6+3
fluttertoast: …Run Code Online (Sandbox Code Playgroud) 我想根据自定义格式验证字符串:(_.__,_.__). 这应该是一个十进制输入,后跟一个逗号,然后是另一个十进制输入,用括号括起来——例如(1.01,3.21). 我希望字符串模式接受一个或多个条目——例如(1.01,3.21)(3.01,4.51)...(2.1,5.6). 有可能这样做吗?
将现有JsonElement格式格式化为格式化 JSON 字符串的 API 在哪里。该ToString()API不提供任何格式选项。
重新使用 Newtonsoft 很烦人
Newtonsoft.Json.Linq.JValue
.Parse(myJsonElement.GetRawText())
.ToString(Newtonsoft.Json.Formatting.Indented)
Run Code Online (Sandbox Code Playgroud) 我试图将按钮绝对放置在iframe上。但是,当在移动网络中查看我的应用程序时,不会记录任何按钮单击;相反,点击会在其下方的 iframe 上注册。
完全相同的实现也适用于非移动网络。

这是我当前使用的代码:
<div style={{ width: '100vw', height: '100vh', display: 'flex', position: 'relative' }} />
<button
style={{ position: 'absolute', top: 0, bottom: 0, zIndex: 1 }}
onClick={() => console.log('button clicked')}
>
click here
</button>
<iframe style={{ width: '100%' }} src={src} />
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试过的其他一些事情:
z-index将的设置iframe为较低的数字(iframe仍然会被点击)pointer-events按钮iframe点击仍未注册)button在一个diviframe在一个divbuttonc# ×4
asp.net-core ×3
.net-core ×2
razor-pages ×2
string ×2
.net-5 ×1
ajax ×1
asp.net-mvc ×1
c#-8.0 ×1
dart ×1
facebook ×1
flutter ×1
format ×1
iframe ×1
mobile ×1
rawrabbit ×1
reactjs ×1
regex ×1
validation ×1