我发现自己错过了 . 在点源文件中,并在从 C# 切换到 PS 时花了一点时间让我站稳脚跟。有没有办法给 . 或者使用更明显的类似命令?
我在Azure Service Fabric中进行开发,并且有几次由于某种原因(通常在重新启动后)未启动Service Fabric。系统托盘中的Service Fabric管理器的响应时间很糟(如果它完全响应的话)。
是否可以使用PowerShell cmdlet甚至cli命令来启动本地Service Fabric?
我有一节课:
public class classParty
{
private int _arrivedCount;
public int PartyID {get; private set;}
public DateTime PartyDate {get; private set;}
public int ArrivedCount
{
get
{
return _arrivedCount;
}
set
{
_arrivedCount = value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我可以映射PartyId和PartyDate但是我没有ArrivedCount的列(它是时间计数的一个时刻,它不会持续存在).
如何告诉EF 4.1停止查找名为"ArrivedCount"的列?它不在桌子上.它不会出现在桌子上.它只是对象的一个属性,而这就是全部.
提前致谢.
编辑:这是classParty的Fluent API配置.
public class PartyConfiguration : EntityTypeConfiguration<classParty>
{
public PartyConfiguration()
: base()
{
HasKey(p => p.PartyID);
Property(p => p.PartyID)
.HasColumnName("PartyID")
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
.IsRequired();
Property(p => p.PartyDate)
.HasColumnName("PartyDate")
.IsRequired();
ToTable("Party");
}
}
Run Code Online (Sandbox Code Playgroud) 我看了一遍,我找不到答案.使用是否更好,更糟或无动于衷:
{
...
RefreshPaintDelegate PaintDelegate = new RefreshPaintDelegate(RefreshPaint);
Control.Invoke(PaintDelegate);
}
protected void RefreshPaint()
{
this.Refresh();
}
Run Code Online (Sandbox Code Playgroud)
...要么...
Task.Factory.StartNew(() =>
{
this.Refresh();
},
CancellationToken.None,
TaskCreationOptions.None,
uiScheduler);
Run Code Online (Sandbox Code Playgroud) 我被告知在MVVM中为视图设置DataContext的最佳方法是使用DataTemplate.所以我试图通过使用DataTemplate将MainWindow的DataContext设置为MainWindowViewModel的实例.
我一直无法弄清楚如何.
我已经尝试将ResourceDictionary放在不同的地方(在App.xaml中,在Window.Resources标签中......)
我用谷歌搜索无济于事.这就是我所拥有的......(它不起作用,但在这里它是)
App.xaml中:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary1.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
Dictionary1.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DataTemplateTesting" >
<DataTemplate DataType="{x:Type local:MainViewModel}">
<local:MainWindow/>
</DataTemplate>
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
MainViewModel.cs
namespace DataTemplateTesting
{
public class MainViewModel
{
public MainViewModel() { }
}
}
Run Code Online (Sandbox Code Playgroud)
我做的唯一另一件事是为MainWindow添加一个处理程序,用于DataContextChanged事件,所以我可以看到它是否曾被激活......它没有.
任何想法如何解决这一问题??
编辑:这里没有任何东西无法生成,但是......这里是MainWindow代码.
MainWindow.xaml
<Window x:Class="DataTemplateTesting.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DataTemplateTesting"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525"
DataContextChanged="Window_DataContextChanged" >
<Grid>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
MainWindow.xaml.cs
namespace DataTemplateTesting
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{ …
Run Code Online (Sandbox Code Playgroud) 我正在使用应用程序注册来部署资源,但证书即将过期。我正在尝试编写一个脚本来添加新证书以延长此服务主体的寿命,但无论我以谁身份登录(我自己、同事、服务主体本身),我都会收到以下错误:
New-AzADSpCredential : Insufficient privileges to complete the operation. At X:\XXX\XXXX\XXXXX\Add-NewDmfCertificate.ps1:496 char:63
+ ... cipalName | New-AzADSpCredential -CertValue $credValue -StartDate $ce ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-AzADSpCredential], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.NewAzureADSpCredentialCommand
Run Code Online (Sandbox Code Playgroud)
编辑:
一些评论促使我阐述我的问题,因为我不确定我是否清楚。
英语是我的母语,我确实理解该信息的基本含义。我不明白的是如何解决这个问题。我是服务主体的所有者。我的同事是一位业主。服务主体应该能够自我管理(我认为)。我已经在我创建的服务主体上对此进行了测试,并且它有效。所以我不得不想:我这样做正确吗?如果没有,如何将证书凭据添加到 SP?如果我做得正确,我应该在哪里设置权限以允许 SP(最好)或 AD 用户进行此更改?
编辑2:
我是一个糟糕的用户。感谢您指出我忽略了包含代码示例。不确定它有多大帮助,但无论我的想法如何,我都知道足以将其包括在内。
param (
[string] $ServicePrincipalName
)
$cert = New-SelfSignedCertificateEx (you'll forgive me for leaving this part out :) )
$rawCert = $cert.RawData
$credValue = [System.Convert]::ToBase64String($rawCert)
Get-AzADServicePrincipal -DisplayName $ServicePrincipalName | New-AzADSpCredential -CertValue $credValue -StartDate $cert.NotBefore -EndDate $cert.NotAfter
Run Code Online (Sandbox Code Playgroud) 这是一个设计决定,但由于我是这个项目的唯一开发人员,我没有其他人可以问.
我有一个MVVM项目,我有一个允许用户将人员添加到聚会预订的视图.有一个商业规则(和那个讨厌的"现实")说一个人不能被添加到同一个聚会的预订中.View调用RelayCommand来添加Person.
由于有添加Person的业务规则,我知道我需要调用Model.我的问题是:怎么样?
我可以在Model中调用一个方法,传递Person,如果返回true,我可以添加Person. - 或者 - 我可以订阅ViewModel的PropertyChanged,如果有人添加,请检查它们并在属性失败时清除它们.
前进的更好方法是什么?
c# ×3
azure ×2
powershell ×2
wpf ×2
azure-devops ×1
data-binding ×1
datacontext ×1
datatemplate ×1
mapping ×1
mvvm ×1
task ×1