我有一些相当简单的状态需求(目前).我想我想使用Stateless api 对这些进行建模.(但我对国家机器并不是很了解,所以我错了.)
但是我被卷入了术语(特别是状态和触发器)
这是一个例子:我有一个订单类.它设置有几个状态.它们是:新的,填充的,装运的,已完成的,已取消的.
我想要的一些简单的状态规则是允许这些状态转换:
那么我在这里被绊倒的是我的"触发器"是什么?
如果需要更具体的示例,请说我想要一个这样的方法:
public bool UpdateOrderStatus(int OrderId, OrderStatusEnum NewOrderStatus)
Run Code Online (Sandbox Code Playgroud)
如果状态更新成功,则返回true.如何设置和使用Stateless来实现这一目标?
我一直试图"在线之间阅读"关于NetSqlAzMan项目的原始(和/或当前)动机.
这是写的吗?
适用于Windows授权管理器(AzMan)的适配器.NetSqlAzMan中的方法只是将调用传递给(Windows授权管理器(AzMan)),但是可能使用更好/更清晰的方法?
(Windows授权管理器(AzMan))的替代品.在(Windows授权管理器(AzMan))中可用的功能(大部分或全部)在NetSqlAzMan中重新创建,但代码是独立开发的.(也许是为了提供DotNet 4.0支持???)(也许是为了删除任何COM依赖项)
提供比(Windows授权管理器(AzMan))提供的更多功能.Aka,(Windows授权管理器(AzMan))的"更智能"/"更好"版本.
重写,但也通过开源保持一个半死的项目.(可能是(Windows授权管理器(AzMan)))是微软的一个死的或被遗弃的项目.
其他?
................
我喜欢NetSqlAzMan的对象模型.但我需要捍卫任何将其用于我的项目经理和其他开发人员的决定.对象模型似乎"恰到好处"(想想金发姑娘和中间床)就我对安全的渴望而言.我不想做基于角色的安全性.我想要正确(或任务或许可)的安全性.
(参见:http: //lostechies.com/derickbailey/2011/05/24/dont-do-role-based-authorization-checks-do-activity-based-checks/ 和 http://granadacoder.wordpress.com/ 2010/12/01/rant-hard-coded-security-roles / )
基本上提出的问题是:"使用NetSqlAzMan而不是(Windows授权管理器(AzMan))有什么好处?"
子问题是"Windows授权管理器(AzMan)死了吗?".(还有Long Live NetSqlAzMan的内容!).
..................
我的一般要求是:
非Active Directory用户.(在路上Active Directory和/或LDAP支持会很好,但不是必需的).密码未存储为纯文本.能够处理安全检查的权利.
将权利分组在任何角色下.为用户分配角色.(但同样,代码将检查权限,而不是执行操作时的角色.)允许(有时)将权限分配给用户.使用拒绝覆盖.(Aka,一个做愚蠢事情的用户(比如"删除员工")可以撤销该权利.)可以为多个应用程序维护角色和权限.
所以欢迎其他想法.但Windows Identity Foundation看起来有点矫枉过正.
谢谢.
在使用c#无状态库时,人们如何构建代码?
https://github.com/nblumhardt/stateless
我特别感兴趣的是它如何与注入的依赖关系以及正确的职责和分层方法联系起来.
我目前的结构涉及以下内容:
public class AccountWf
{
private readonly AspNetUser aspNetUser;
private enum State { Unverified, VerificationRequestSent, Verfied, Registered }
private enum Trigger { VerificationRequest, VerificationComplete, RegistrationComplete }
private readonly StateMachine<State, Trigger> machine;
public AccountWf(AspNetUser aspNetUser, AccountWfService userAccountWfService)
{
this.aspNetUser = aspNetUser;
if (aspNetUser.WorkflowState == null)
{
aspNetUser.WorkflowState = State.Unverified.ToString();
}
machine = new StateMachine<State, Trigger>(
() => (State)Enum.Parse(typeof(State), aspNetUser.WorkflowState),
s => aspNetUser.WorkflowState = s.ToString()
);
machine.Configure(State.Unverified)
.Permit(Trigger.VerificationRequest, State.VerificationRequestSent);
machine.Configure(State.VerificationRequestSent)
.OnEntry(() => userAccountWfService.SendVerificationRequest(aspNetUser))
.PermitReentry(Trigger.VerificationRequest)
.Permit(Trigger.VerificationComplete, State.Verfied);
machine.Configure(State.Verfied)
.Permit(Trigger.RegistrationComplete, State.Registered); …
Run Code Online (Sandbox Code Playgroud) RabbitMQ 文档说明:
Default Virtual Host and User
When the server first starts running, and detects that its database is uninitialised or has been deleted, it initialises a fresh database with the following resources:
a virtual host named /
Run Code Online (Sandbox Code Playgroud)
该API有类似的事情:
/api/exchanges/#vhost#/?name?/bindings
Run Code Online (Sandbox Code Playgroud)
哪个"?名字?" 是一个特定的交换名称.
但是,为默认的 -vhost #vhost#做了什么?
在我的档案中
LogicApp.parameters.json
我已经声明了名为MyFirstNewParameter的额外参数
完整文件内容如下
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"value": "MyFirstLogicAppOne"
},
"servicebus_1_connectionString": {
"value": "Endpoint=sb://notForYouToSee"
},
"MyFirstNewParameter": {
"value": "abc123"
}
}
}
Run Code Online (Sandbox Code Playgroud)
在我的LogicApp.json文件中,我添加了MyFirstNewParameter的"声明".
在里面
"参数":{}
区域(下面第4行是该部分开始的地方)
我还添加了一个简单的响应,尝试读取参数值并将其发送回响应中.(所有事情都命名为"Read_And_Use_Parameter_Value_Simple_Response")
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"metadata": {
"description": "Name of the Logic App."
}
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast", …
Run Code Online (Sandbox Code Playgroud) 虽然如此,但我对第一个并不感兴趣.
Customer foundCustomer = context.Set<Customer>().Include(e => e.Orders.Select ( d => d.OrderLines)).FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)
这很有效,我找到了我正在努力的比赛.
string custKey = "VINET";
Customer foundCustomer = context.Set<Customer>().Include(e => e.Orders.Select(d => d.OrderLines)).Where(c => c.CustomerID.Equals(custKey, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)
这工作,并按我的意愿读取数据库,但没有我想要的包含.
Customer foundCustomer = context.Set<Customer>().Find(custKey);
Run Code Online (Sandbox Code Playgroud)
这不起作用....但是我实际上是在追求
Customer foundCustomer = context.Set<Customer>().Include(e => e.Orders.Select(d => d.OrderLines)).Find(custKey);
Run Code Online (Sandbox Code Playgroud)
有什么方法结合起来Include()
使用Find()
?
这是上下文.典型的Northwind Customer/Order(s)/ OrderDetails方案.
public partial class WindyContext : DbContext
{
static WindyContext()
{
//Database.SetInitializer<WindyContext>(null);
}
public WindyContext()
: base("Name=NorthwindContext")
{
}
public DbSet<Customer> Customers { get; set; }
public DbSet<OrderLine> DbSetOrderLines { get; set; …
Run Code Online (Sandbox Code Playgroud) 我在最新的 Windows 版本 Windows 10 2004 上使用 Linux 容器并启用 WSL 2 和 Docker Desktop 2.3.0.3 (45519)。
我右键单击 docker-compose 文件,然后选择Set as Startup Project
.
然后我按 F5 进行调试。
我可以看到正在运行的图像,docker ps
但是没有命中断点。
我无法查看日志(在 Visual Studio Containers 窗口中),因为它说:
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '3.1.0' was not found.
- No frameworks were found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=x64&rid=debian.10-x64 …
Run Code Online (Sandbox Code Playgroud) 使用Internet Explorer,您可以创建一个.bat
文件来清除缓存.
例:
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
REM History:
REM RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
REM Cookies:
REM RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
REM Temp Internet Files:
REM RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
REM Form Data:
REM RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
REM Passwords:
REM RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
REM OR
REM All:
rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
Run Code Online (Sandbox Code Playgroud)
有没有办法用Chrome和/或Firefox做到这一点?
也就是说,使用.bat
在Windows计算机上运行的文件或powershell脚本,清除Chrome或Firefox的缓存?
我保证,我看了.
我有以下设置:
set __vsTestConsoleExe=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
set __codeCoverageExe=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
set __testFile=My.UnitTests.dll
REM Below I get a ".coverage" file with the correct coverage. But the file name is kinda-random
"%__vsTestConsoleExe%" "%__testFile%" /InIsolation /EnableCodeCoverage
PAUSE
REM Below I get a big ole nothing
"%__codeCoverageExe%" collect /output:DynamicCodeCoverage.coverage "%__vsTestConsoleExe%" "%__testFile%" /InIsolation /EnableCodeCoverage
"%__codeCoverageExe%" analyze /output:DynamicCodeCoverage.coveragexml DynamicCodeCoverage.coverage
Run Code Online (Sandbox Code Playgroud)
当以下行运行时:
"%__vsTestConsoleExe%" "%__testFile%" /InIsolation /EnableCodeCoverage
Run Code Online (Sandbox Code Playgroud)
我得到一个很好的.coverage文件,但它生成的文件名如下:
MyUSERNAME_MYMACHINE 2016-03-24 16_03_20.coverage
Run Code Online (Sandbox Code Playgroud)
PAUSE语句之后的行(在第一个代码块中)看起来应该收集覆盖范围(注意,我给它的相同''%__ vsTestConsoleExe%''comamand .......但是我变大了什么都没有.
我究竟做错了什么?
http://netcommon.sourceforge.net/
Common.Logging是具体的"记录器"之上的抽象(例如:log4net,Enterprise Library Logging,NLog)
Message Queue系统有什么可用的吗?(示例:msmq,rabbitmq,DotNetMQ,ZeroMQ等)