好吧,我猜我错过了一个非常简单的东西.
可以说我有多种方法可以重复很多相同的事情:
public getDepartments(id: number): ng.IPromise<IDepartmentViewModel[]> {
this.common.loadStart();
return this.unitOfWork.teamRepository.getDepartmentsForTeam(id).then((response: IDepartmentViewModel[]) => {
this.common.loadComplete();
return response;
}).catch((error) => {
this.common.loadReset();
return error;
});
}
Run Code Online (Sandbox Code Playgroud)
大量的样板,用于单次调用 this.unitOfWork.teamRepository.getDepartmentsForTeam(id)
所以我想为样板制作一个通用的包装器,例如:
private internalCall<T>(method: () => ng.IPromise<T>): ng.IPromise<T> {
this.common.loadStart();
return method().then((response: T) => {
this.common.loadComplete();
return response;
}).catch((error) => {
this.common.loadReset();
return error;
});
}
Run Code Online (Sandbox Code Playgroud)
我可以称之为:
public getDepartments(id: number): ng.IPromise<IDepartmentViewModel[]> {
return this.internalCall<IDepartmentViewModel[]>(this.unitOfWork.teamRepository.getDepartmentsForTeam(id));
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Supplied parameters do not match any signature of call target:
Type '() => ng.IPromise<IDepartmentViewModel[]>' requires a call signature, but type …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现属性路由和VersionedRoute来自RoutingConstaints示例,但是当我在控制器上使用两者时,版本化属性不再起作用.
我需要在属性上修改什么才能让它与属性路由一起使用?
对于代码示例,请下载示例项目(或者只查看上面链接中的几个文件),然后修改路由:
// When I use the RoutePrefix, VersionedRoute no longer works (Sending "Api-Version" through http header doesn't route correctly
// If I remove the RoutePrefix I can use VersionedRoute again
// What do I need to change in its code to be able to use both?
[VersionedRoute("api/Customers", 1)] // This route would be used as http://url/api/customers with a header of "api-version: 1"
[RoutePrefix("api/v1/Customers")] // This route would be used purely through url …Run Code Online (Sandbox Code Playgroud) 我们在服务器上使用内部证书,我已按照步骤操作
以及这里的步骤:
作为服务运行时出错:
git version
git config --get remote.origin.url
git config gc.auto 0
git config --get-all http.https://ourtfsserver:8443/tfs/path/_git/project.extraheader
git config --get-all http.proxy
git -c http.extraheader="AUTHORIZATION: bearer ********" fetch --tags --prune --progress origin
fatal: unable to access 'https://ourtfsserver:8443/tfs/path/_git/project/': SSL certificate problem: unable to get local issuer certificate
##[error]Git fetch failed with exit code: 128
Run Code Online (Sandbox Code Playgroud)
当使用相同的代理程序配置运行但使用.\ run.cmd而不是作为服务(相同的凭据)时,它可以成功运行:
git version
git config --get remote.origin.url
git config gc.auto 0
git config --get-all http.https://ourtfsserver:8443/tfs/path/_git/project.extraheader
git config --get-all http.proxy
git -c http.extraheader="AUTHORIZATION: bearer ********" fetch …Run Code Online (Sandbox Code Playgroud) 我正在开发模块化应用程序,并决定重新启动并将Prism集成到我正在尝试创建的内容中,而不是尝试重新创建方向盘.
要求:
例如:
普通用户:访问查看,创建,修改,特殊工具1
高级用户:访问查看,创建,修改,删除,特殊工具1,特殊工具2
我应该使用MVVM Light等MVVM框架,还是Prism(v4)对WPF的MVVM(我见过的所有示例都使用Silverlight)提供足够的支持以用于大规模应用程序?
那里有一些很好的资源吗?我试过搜索,但大多数时候发现人们在几个月/几年前问同样的问题.我已经阅读了大多数Microsoft Prism开发者指南,但它没有很多例子,更多的是Prism如何工作的概述,它对MVVM的例子是基于Silverlight的.
你有推荐的书吗?我看过使用WPF和MVVM构建企业应用程序,但它没有最好的评论,大多数人说它在代码/细节方面也很短.
我正在尝试为Strathweb.CacheOutput.WebApi2创建一个Redis提供程序,但是尝试从byte [] - > RedisValue - > byte []转换为null.
我可以手动将对象类型设置为byte []而不是var/RedisValue,它将正确地将值作为byte []返回,但在将其设置为RedisValue后,它无法将其转换为byte [].
他的接口有Get总是返回一个对象所以我不能强制类型或使用单独的调用而不必修改接口.
如果我尝试做一个result as byte[]我得到
Cannot convert type 'StackExchange.Redis.RedisValue' to 'byte[]' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
如果我尝试做一个(byte[])result我得到Cannot cast 'result' (which has an actual type of 'StackExchange.Redis.RedisValue') to 'byte[]'
有什么我缺少的东西,或者我将不得不通过检查基于密钥查找的数据类型来以某种方式破解它?
这是界面:
namespace WebApi.OutputCache.Core.Cache
{
public interface IApiOutputCache
{
void RemoveStartsWith(string key);
T Get<T>(string key) where T : class;
object Get(string key);
void Remove(string key);
bool …Run Code Online (Sandbox Code Playgroud) Chrome 72+ 现在在 # 字符的第一个符号处截断我们的数据。
https://bugs.chromium.org/p/chromium/issues/detail?id=123004#c107
我们一直在使用临时锚标记以及带有 csv 字符串的下载属性和 href 属性,以将页面上的 csv 数据下载到用户的机器上。这在最近的 Chrome 更新中被破坏了,因为第一个 # 号之后的所有数据都从下载的 csv 中删除。
我们可以通过用“num”或其他数据替换 # 来解决这个问题,但这会使我们的 csv/excel 文件具有我们希望避免的不同数据。
我们可以做些什么来防止chrome在下载文件时剥离href中的数据?
let csvContent = "data:text/csv;charset=utf-8,";
let header = "Col1, Col2, Col3";
csvContent += header + "\r\n";
csvContent += "ac, 123, info here" + "\r\n";
csvContent += "dfe, 432, #2 I break" + "\r\n";
csvContent += "fds, 544, I'm lost due to previous number sign";
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "file.csv"); …Run Code Online (Sandbox Code Playgroud) 我在主窗口上添加了用于关闭事件的代码,该代码适用于单击 X,并且能够毫无问题地取消事件(它通过“您确定吗?确保保存”类型的对话框运行,并且闭幕式活动)
不幸的是,如果我双击该图标,它会遇到事件断点RibbonWindow_Closing,但是当e.Cancel设置为 true 时,它无论如何都会关闭,就好像它被调用一样Application.Current.Shutdown()
Alt-F4(和图标 -> 关闭)和 X 按钮均已正确处理,但未双击图标本身
有谁知道为什么会发生这种情况?我正在使用 Prism,如果重要的话,主窗口是由引导程序创建的。
这是堆栈跟踪,除了点击我的 RibbonWindow_Closing 事件之外,它是所有外部代码:
MyProgram.exe!MyProgram.Shell.RibbonWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) Line 64 C#
PresentationFramework.dll!System.Windows.Window.OnClosing(System.ComponentModel.CancelEventArgs e) + 0x91 bytes
Run Code Online (Sandbox Code Playgroud)
PresentationFramework.dll!System.Windows.Window.WmClose() + 0x96 bytes
PresentationFramework.dll!System.Windows.Window.WindowFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xe5 bytes
PresentationCore.dll!System.Windows.Interop.HwndSource.PublicHooksFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x7e bytes
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xbe bytes
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) …Run Code Online (Sandbox Code Playgroud) 使用1.4的BreezeJS,我们发现添加到Isolate ES5 Properties的一些新代码导致IE 8出现以下错误:
获取元数据时出错:breeze/breeze/Metadata的元数据导入失败; 无法处理返回的元数据:对象不支持属性或方法'getPrototypeOf'
我们尝试使用Uber Proto的getPrototypeOf(https://github.com/daffl/uberproto)和es5-sham(https://github.com/kriskowal/es5-shim),但两者都有同样的问题.
我们还尝试删除常规json.parse并使用json2的版本具有相同的结果.
/ breeze/breeze/Metadata的元数据导入失败; 无法处理返回的元数据:堆栈空间不足
Chrome,Firefox和IE 9+没有问题,但需要IE 8支持.我们可以注释掉该行以使其工作:
// isolateES5Props(proto);
Run Code Online (Sandbox Code Playgroud)
但我猜这会导致某些问题.
使用这个:
https://genericunitofworkandrepositories.codeplex.com/
和以下一组博客文章:
我们正在尝试使用这些存储库,Breeze因为它非常好地处理客户端javascript和OData.
我想知道如何使用这些Breeze来处理BeforeSaveEntity正确的覆盖.
我们有相当多的业务逻辑,需要在保存过程中(如修改属性发生ModifiedBy,ModifiedTime,CreatedBy但是当我们改变那些他们没有被微风更新,所以我们有后保存重新查询(我们已经等)尝试手动映射更改,但它要求我们复制所有业务逻辑).
我们的第二个选择是检查每个类型,entity然后为它请求正确的存储库,在内部处理保存,然后在客户端上执行新的get请求以获取更新的信息.这很健谈,所以我们希望有更好的方法.在绕过微风的保存而不返回错误或之后必须重新获取数据的情况下,更新这些对象的正确方法是什么?
保存期间Breeze with Business Logic的任何示例都非常有用,特别是如果它直接在BeforeSaveEntity方法中发生在服务,存储库或其他内容中.
我正在尝试使用以下方法将AngularJS中的事件发送到第二个控制器:
第一控制员:
$scope.checkThemeContent = function(theme) {
console.log("Trying to get cards for theme id: " +theme.id);
console.log(theme);
$scope.selectedTheme = theme;
if(theme.count_of_cards >0) {
//$scope.$emit('detailDisplayed', {});
$scope.displayedTemplate = 'detail';
$rootScope.$emit('detailDisplayed', {});
} else {
$scope.displayedTemplate = 'empty';
}
};
Run Code Online (Sandbox Code Playgroud)
第二控制器:
$rootScope.$on('detailDisplayed', function(event, args) {
alert('Received');
$scope.initDataGrid();
});
Run Code Online (Sandbox Code Playgroud)
但事件不会被触发.
我试图在反方向使用范围,它的工作原理.
请问哪里有问题?
我按照本教程:
http://toddmotto.com/all-about-angulars-emit-broadcast-on-publish-subscribing/
谢谢你的帮助.