我在缩放图时遇到了这个问题,这是通过GIS控件Greatmap绘制的.但是一个简单的实验说服我在WPF中存在更深层次的问题.
考虑简单的WPF应用程序:
这是MainWindow.xaml
<Grid>
<StackPanel>
<Slider ValueChanged="Size_Changed" Minimum="0" Maximum="300000"/>
<TextBox x:Name="Value"></TextBox>
</StackPanel>
<Canvas>
<Path x:Name="MyPath" Stroke="Black" StrokeThickness="2" />
</Canvas>
</Grid>
Run Code Online (Sandbox Code Playgroud)
这就是它背后的代码
private void Size_Changed(object sender,
RoutedPropertyChangedEventArgs<double> e)
{
if (MyPath == null) return;
var g = new StreamGeometry();
using (var s = g.Open())
{
var pointA = new Point(0, 200);
s.BeginFigure(pointA, false, false);
var pointB = new Point(e.NewValue, 200);
s.PolyLineTo(new[] {pointB}, true, true);
Value.Text = $"zoom = {e.NewValue:0.0} ; pointA = {pointA.X:#,0} ; pointB = {pointB.X:#,0}";
}
g.Freeze();
MyPath.Data = …Run Code Online (Sandbox Code Playgroud) 我正在尝试遵循 AspNet Core 1.1 的一些过时的教程项目(同时我使用的是 Visual Studio 2019 预览版 2.0,并且安装了 .net core v3.0.0-preview9)
我已经有一个数据库,其中包含由 EntityFrameworkCore3.00-preview 创建的几个表,它工作正常。
现在我正在尝试将自动化添加到项目中所以我从 IdentityDbContext 派生了我的数据库上下文类,
public class MyDbContext : IdentityDbContext
代替
public class WorldContext : DbContext
进行添加迁移和更新数据库,在数据库中我看到许多新表
此时我的应用程序可以启动,但就在我添加一行的那一刻
services.AddIdentity<IdentityUser, IdentityRole>();
到 Startup.cs 中的 ConfigurationServices
应用程序崩溃并显示以下消息:
System.AggregateException HResult=0x80131500 消息=无法构建某些服务(验证服务描述符时出错:“ServiceType: Microsoft.AspNetCore.Identity.ISecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SecurityStampValidator
1[Microsoft.AspNetCore.Identity.IdentityUser]': Unable to resolve service for type 'Microsoft.AspNetCore.Identity.IUserStore1[Microsoft.AspNetCore .Identity.IdentityUser]'同时尝试激活'Microsoft.AspNetCore.Identity.UserManager1[Microsoft.AspNetCore.Identity.IdentityUser]'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ITwoFactorSecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.TwoFactorSecurityStampValidator1[Microsoft.AspNetCore.Identity.IdentityUser]':无法解析类型'Microsoft.AspNetCore.Identity.IUserStore1[Microsoft.AspNetCore.Identity.IdentityUser]' while attempting to activate 'Microsoft.AspNetCore.Identity.UserManager1[Microsoft.AspNetCore. Identity.IdentityUser]'。)(验证服务描述符“ServiceType:Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory”时出错1[Microsoft.AspNetCore.Identity.IdentityUser] …