我正在使用MVC3,Entity Framework v4.3 Code First和SimpleInjector.我有几个简单的类看起来像这样:
public class SomeThing
{
public int Id { get; set; }
public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我有另一个看起来像这样的实体:
public class MainClass
{
public int Id { get; set; }
public string Name { get; set; }
public virtual AThing AThingy { get; set; }
public virtual BThing BThingy { get; set; }
public virtual CThing CThingy { get; set; }
public virtual DThing DThingy { get; set; }
public virtual EThing EThingy { …Run Code Online (Sandbox Code Playgroud) dependency-injection asp.net-mvc-3 simple-injector entity-framework-4.3.1
我正在尝试在我的.NET MVC 3应用程序上实现此命令模式,专门用于保存对Thing的编辑.我还没有决定如何继续.在我得到实际问题之前,这里是简化的代码:
public class ThingController
{
private readonly ICommandHandler<EditThingCommand> handler;
public ThingController(ICommandHandler<EditThingCommand> handler)
{
this.handler = handler;
}
public ActionMethod EditThing(int id)
{
...build EditThingViewModel and return with View...
}
[HttpPost]
public ActionMethod EditThing(int id, EditThingViewModel vm)
{
var command = new EditThingCommand
{
...not sure yet...
};
this.handler.Handle(command);
...redirect somewhere...
}
}
Run Code Online (Sandbox Code Playgroud)
我的EditThingViewModel完全与我的域断开连接,该域由POCO类组成.看起来我的EditThingCommand应该如下所示:
public class EditThingCommand
{
Thing ModifiedThing;
}
Run Code Online (Sandbox Code Playgroud)
但是,构建ModifiedThing仍然会在我的控制器中发生.这是本案中的大部分工作.在构建ModifiedThing时(以及应用于它的"旧"时间戳进行乐观并发检查),剩下的就是命令在我的数据上下文上调用Update.
显然,能够使用其他命令轻松装饰它是有价值的,但我也希望能够在我的控制器之外移动ModifiedThing的构造.(也许这个问题就是这个问题.)EditThingCommand在我的域中,没有对EditThingViewModel的引用,所以它不能去那里.在我的表示层中有另一个命令将我的viewmodel映射到我的poco实体是否有意义?
single-responsibility-principle command-pattern asp.net-mvc-3
在尝试将Lightswitch应用程序部署到运行IIS 7.5的Windows 2008 R2服务器时,我已经尽力表达了我的挫败感.导航到应用程序后,我收到以下执行错误:
查询'GetAuthenticationInfo'的加载操作失败.远程服务器返回错误:NotFound.
.NET跟踪和服务器事件日志都有这样的说法:
发件人信息:System.ServiceModel.Activation.HostedHttpRequestAsyncResult/63835064例外:System.Web.HttpException(0x80004005):服务'/Web/Microsoft-LightSwitch-Security-ServerGenerated-Implementation-AuthenticationService.svc'不存在.
配置详细信息如下:
在服务器端:
我尝试过的:
这些都没有任何影响.我对上面的粗体错误的唯一暗示是.svc是在运行时生成的,如果WCF端出现其他问题,它将抛出404错误.(这就是我尝试安装RiaServices.msi的原因.)
我能够"现在远程发布到服务器"到我自己的本地IIS Express,那里的应用程序运行正常.但是,将这些文件复制到远程服务器会产生与以前相同的结果.
有关如何进一步排除故障的任何建议?
silverlight iis-7.5 wcf-ria-services visual-studio-lightswitch