在新的ASPNET MVC应用程序中,您现在可以免费获得AspIdentity的好东西.
这里有一条无害的小插件"插入你的电子邮件服务".
所以我做了:
public class EmailService : IIdentityMessageService
{
private static My.Services.IEmailService _emailservice;
public EmailService(Insolvency.Services.IEmailService emailservice)
{
_emailservice = emailservice;
}
public Task SendAsync(IdentityMessage message)
{
_emailservice.SendEmail(message);
return Task.FromResult(0);
}
}
Run Code Online (Sandbox Code Playgroud)
而现在的喜悦:
public class ApplicationUserManager : UserManager<ApplicationUser>
{
private My.Services.IEmailService _emailservice;
public ApplicationUserManager(IUserStore<ApplicationUser> store, My.Services.IEmailService emailservice): base(store)
{
_emailservice = emailservice;
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()), _emailservice);
...
Run Code Online (Sandbox Code Playgroud)
当Owin踢它时,调用Startup.Auth.cs中的Create on ApplicationUserManager :
public partial class Startup
{ …Run Code Online (Sandbox Code Playgroud) try-convert -w Test.csproj --target-framework netstandard2.0
Run Code Online (Sandbox Code Playgroud)
结果是:
Multiple installs of MSBuild detected please select one:
...
Instance 6
Name: .NET Core SDK
Version: 3.0.100
MSBuild Path: C:\Program Files\dotnet\sdk\3.0.100-preview7-012821\
Run Code Online (Sandbox Code Playgroud)
但指定这些路径之一
try-convert -w Test.csproj --target-framework netstandard2.0 -m "C:\Program Files\dotnet\sdk\3.0.100-preview7-012821\"
Run Code Online (Sandbox Code Playgroud)
结果是 :
System.ArgumentException: Directory "C:\Program Files\dotnet\sdk\3.0.100-preview7-012821"" does not exist (Parameter 'msbuildSearchPaths')
A directory or directories in "msbuildSearchPaths" do not exist
Run Code Online (Sandbox Code Playgroud) 如何通过超链接打开外部浏览器,在浏览器中是target='_top'。
WPF netcore 3.1 应用程序中的代码是什么?
使用命令参数
<TextBlock>
<Hyperlink CommandParameter="{Binding ExternalURL}"
Command="{Binding NavHomeViewCommand}" >Open in Browser ...
</Hyperlink>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)更改 DelegateCommand 以使用对象参数(使用 prismlibrary mvvm 模式)
navHomeViewCommand = new DelegateCommand<object>(NavHomeView);
Run Code Online (Sandbox Code Playgroud)命令属性:
public string ExternalURL{ get => "https://www.google.com/";}
private readonly ICommand navHomeViewCommand;
public ICommand NavHomeViewCommand
{
get { return navHomeViewCommand; }
}
Run Code Online (Sandbox Code Playgroud)打开浏览器
private void NavHomeView(object ID)
{
if(obj is string destinationurl)
System.Diagnostics.Process.Start("https://google.com"); //???????
}
Run Code Online (Sandbox Code Playgroud)抛出异常“未知的可执行文件”。
为什么在 OUTPUT/INSERTED 行中无法识别 INSERT 表别名?
编辑:链接表需要填充新的@Data_Table.Id(INSERTED.id,有效)和@NewData_Table.ObjectId(错误)。这样就可以创建一个具有从@Data_Table到@Tmp_Link_Table的外键关系的“链接表”。
编辑:
--Expected Output
--ObjectId DataId
--11 3
--12 4
--13 5
--14 6
DECLARE @NewData_Table TABLE
( [Data] VARCHAR(50) NOT NULL,
ObjectId INT NOT NULL)
DECLARE @Tmp_Link_Table TABLE
( ObjectId INT NOT NULL,
DataId INT NOT NULL)
DECLARE @Data_Table TABLE
( Id INT NOT NULL Identity(1,1),
Data VARCHAR(50) NOT NULL)
-- create new objects
INSERT INTO @NewData_Table (ObjectId, Data) VALUES (11,'Data 1')
INSERT INTO @NewData_Table (ObjectId, Data) VALUES (12,'Data 2')
INSERT INTO @NewData_Table (ObjectId, …Run Code Online (Sandbox Code Playgroud) 好吧Linq'ers.试一试.
为什么会
NextActioners.Select(n => n.NextActioner.Equals(true));
Run Code Online (Sandbox Code Playgroud)
错误地找到2条记录,
但
from a in NextActioners where (a.NextActioner.Equals(true)) select a;
Run Code Online (Sandbox Code Playgroud)
正确找不到?
在我的Good'ol Linqpad上:
public class AppPerson
{
public string PersonId;
public string FullName;
public string Role;
public bool NextActioner;
}
void Main()
{
var NextActioners = new List<AppPerson> {
new AppPerson{FullName="testFullname1", NextActioner=false},
new AppPerson{FullName="testFullname2", NextActioner=false},
};
//Are all the NextActioners 'nextActioner' value false
var noApproversSelected = NextActioners.All(a => a.NextActioner.Equals(false));
Console.WriteLine("noApproversSelected={0}",noApproversSelected.ToString());//Result = true
var listOfApprovers = from a in NextActioners
where (a.NextActioner.Equals(true))
select a;
Console.WriteLine("listOfApprovers.Count()={0}",listOfApprovers.Count().ToString());//Result = …Run Code Online (Sandbox Code Playgroud)