我有一个 Xamarin Forms 应用程序(Android 和 iOS,而不是 UWP),它可以访问我创建的 DotNetCore 2.1 API(在 下运行http://localhost:5000)。所有这些都是使用 Visual Studio 2017 开发的。
我可以使用在 Android 端转换http://10.0.2.2:5000为“localhost”的地址来调试 Android 端。所以我可以从 Android 模拟器中很好地调用我的 API。
问题出在iOS端。
iOS 模拟器实际上在 Mac 上运行,因此无法看到我的 Windows 机器运行 API。
如何配置我的 Windows/Mac 计算机以便能够访问我的本地 API?
我可以从 Mac 上 ping 我的 Windows 机器,但目前仅此而已。
我不得不在 dotnet core 2.1 单页应用程序模板中重新设计一个 angular 应用程序。
我在普通“ClientApp”文件夹旁边的一个新文件夹“Frontend”中完成了它。在本地它工作正常,但是当我部署它或尝试通过“dotnet publish”发布它时,它总是使用 ClientApp 文件夹。
是否可以分别替换重命名 ClientApp 文件夹?
I'm Currently building an application which relies heavily on running multithreaded. I'm Currently spawning as many threads as the system has cores using the environment.ProcessorCount constant, but when I run the application on our server which has 2 separate CPUs (Intel Xeon E5-2620) all threads work on the first CPU while the second CPU idles. Is it possible to utilize the second CPU in one process or do I need to split the process and force the utilisation with Processor …
我正在使用 EF Core 2.2 错误代码
var ClientCase= _context.Client_Cases.Include(a=>a.Case_Sessions). FirstOrDefault(x => x.Id == id);
Run Code Online (Sandbox Code Playgroud)
错误
System.Data.SqlClient.SqlException: '无效的列名 'Client_CaseId'。无效的列名“Case_LevelId”。无效的列名“Client_CaseId”。无效的列名“Court_CircleId”。无效的列名“Court_HallId”。
实体
1- 父 Client_Case
public class Client_Cases
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public string Opponent { get; set; }
public DateTime? StartDate { get; set; }
public DateTime Recieve_Date { get; set; }
[ForeignKey("Clients")]
public long? ClientID { get;set;}
public Clients Client { get; set; }
[ForeignKey("Case_Levels")]
public long? LevelID { get; set; }
public virtual Case_Levels Case_Levels …Run Code Online (Sandbox Code Playgroud) 我安装了EntityFrameworkCore.Design运行以下。
Install-Package Microsoft.EntityFrameworkCore.Design -Version 3.0.0-preview6.19304.10
Run Code Online (Sandbox Code Playgroud)
它似乎已安装,我可以在VS中看到以下内容。
但是,当我尝试使用创建迁移时
dotnet ef migrations add Init
Run Code Online (Sandbox Code Playgroud)
我等待了很长时间,然后出现以下错误。
您的启动项目“Web”未引用 Microsoft.EntityFrameworkCore.Design。这个包是 Entity Framework Core Tools 工作所必需的。确保您的启动项目正确,安装包,然后重试。
当我检查Web.proj文件时,我会看到以下部分。
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.0.0-preview6.19307.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0-preview6.19304.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview6.19304.10" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0-rc2" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
如何确保电脑看到包裹?
c# entity-framework-core .net-core .net-core-3.0 ef-core-3.0
我正在尝试使用 services.AddDataProtection() 中的 PersistKeysToDbContext 扩展将密钥持久化到 SQL。目前我们正在使用 PersistKeysToStackExchangeRedis,它工作得非常好,但是确定需要将其移至 DB。
我们正在使用一个 .net Core 2.2 项目,并添加了以下引用:
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (2.2.0) Microsoft.AspNetCore.DataProtection.Extensions (2.2.0) Microsoft.AspNetCore.DataProtection.StackExchangeRedis (2.2.0) (显然是针对当前功能)
Microsoft.EntityFrameworkCore (2.2.0)
services.AddDataProtection().PersistKeysToDbContext<ApplicationDbContext>();
Run Code Online (Sandbox Code Playgroud)
我从编译器收到以下错误:
“IDataProtectionBuilder”不包含“PersistKeysToDbContext”的定义,并且找不到接受“IDataProtectionBuilder”类型的第一个参数的可访问扩展方法“PersistKeysToDbContext”(您是否缺少 using 指令或程序集引用?)
持久函数是否会在活动被调用之前唤醒?
我是关于实现调度程序的,而是使用其他库,例如 Hangfire 或 Quartz。我想实现作为调度程序的持久功能。我缺少的部分是,函数中发生了什么?该函数是否在下一次活动调用之前大喊大叫?每一项都叫执行?
[FunctionName("SchedulerRouter")]
public static async Task<HttpResponseMessage> HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")]HttpRequestMessage req,
[OrchestrationClient]DurableOrchestrationClient starter, ILogger log)
{
var data = await req.Content.ReadAsAsync<JObject>();
var instanceId = await starter.StartNewAsync(FunctionsConsts.MAIN_DURABLE_SCHEDULER_NAME, data);
return starter.CreateCheckStatusResponse(req, instanceId);
}
Run Code Online (Sandbox Code Playgroud) 根据 Pashov 的博客文章,我有以下静态方法用于在过滤器选项之间进行选择。
public static class ExpressionRetriever
{
private static MethodInfo containsMethod = typeof(string).GetMethod("Contains");
private static MethodInfo startsWithMethod = typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) });
private static MethodInfo endsWithMethod = typeof(string).GetMethod("EndsWith", new Type[] { typeof(string) });
public static Expression GetExpression<T>(ParameterExpression param, ExpressionFilter filter)
{
MemberExpression member = Expression.Property(param, filter.PropertyName);
ConstantExpression constant = Expression.Constant(filter.Value);
switch (filter.Comparison)
{
case Comparison.Equal:
return Expression.Equal(member, constant);
case Comparison.GreaterThan:
return Expression.GreaterThan(member, constant);
case Comparison.GreaterThanOrEqual:
return Expression.GreaterThanOrEqual(member, constant);
case Comparison.LessThan:
return Expression.LessThan(member, constant);
case Comparison.LessThanOrEqual:
return Expression.LessThanOrEqual(member, …Run Code Online (Sandbox Code Playgroud) .net-core ×10
c# ×8
.net ×1
angular ×1
azure ×1
class ×1
core ×1
ef-core-2.2 ×1
ef-core-3.0 ×1
reflection ×1
xamarin ×1