我不敢相信我要问这个问题,但是如何下载Angular UI Grid呢?

之后,我点击下载按钮(上图),我在这里:

怎么办?我没有看到下载按钮.我不知道该怎么做.有人请告诉我,我必须明白这一点.
是否有一种普遍接受的方法来避免在WCF服务上使用KnownType属性?我一直在做一些研究,看起来有两种选择:
我不是每次添加新类型时都必须静态添加KnownType属性的忠实粉丝,因此我想避免它.
是否应该使用第三种选择?如果是这样,它是什么?如果没有,上述两种选择中的哪一种是正确的选择?
编辑 - 使用方法
第三种选择是使用反射
[DataContract]
[KnownType("DerivedTypes")]
public abstract class FooBase
{
private static Type[] DerivedTypes()
{
return typeof(FooBase).GetDerivedTypes(Assembly.GetExecutingAssembly()).ToArray();
}
}
Run Code Online (Sandbox Code Playgroud) 我只是实现了Dispose模式,当我输入GC.SuppressFinalize(this)行时,我想知道是否有一个用例来使用除了this作为方法参数之外的其他东西.
这是典型的模式:
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this); // right here
}
Run Code Online (Sandbox Code Playgroud)
GC.SuppressFinalize()用别的东西打电话有意义this吗?
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(foo); // should this ever happen?
}
Run Code Online (Sandbox Code Playgroud) 我正在努力寻找实现WCF重试的最佳方法.我希望尽可能让客户体验尽可能干净.我知道有两种方法(见下文).我的问题是:" 我缺少第三种方法吗?也许是一种普遍接受的做法? "
方法#1:创建实现服务接口的代理.对于每次调用代理,请执行重试.
public class Proxy : ISomeWcfServiceInterface
{
public int Foo(int snurl)
{
return MakeWcfCall<int>(() => _channel.Foo(snurl));
}
public string Bar(string snuh)
{
return MakeWcfCall<string>(() => _channel.Bar(snuh));
}
private static T MakeWcfCall<T>(Func<T> func)
{
// Invoke the func and implement retries.
}
}
Run Code Online (Sandbox Code Playgroud)
方法#2:将MakeWcfCall()(上面)更改为public,并让消费代码直接发送func.
我不喜欢方法#1,每次接口更改时都必须更新Proxy类.
方法#2我不喜欢的是客户端必须将其调用包装在func中.
我错过了一个更好的方法吗?
编辑
我在这里发布了一个答案(见下文),基于接受的答案,指出了我正确的方向.我以为我会在答案中分享我的代码,以帮助某人完成我必须完成的工作.希望能帮助到你.
是否可以在一个WCF服务中托管多个服务合同?如果是这样,怎么样?我一直在谷歌搜索和一些帖子说你可以做(但不是如何)和其他人说,这是不可能的.
当我运行服务器时,我收到此错误:
在服务'ConsoleAppWcfServer.FooService'实现的合同列表中找不到合同名称'ConsoleAppWcfCommon.IBarService'.
这是我的服务器代码:
static void Main(string[] args)
{
string serviceAddress = "net.tcp://localhost:8088/FooBarService";
// I'm stuck here as I have to pick *one* service
ServiceHost selfServiceHost = new ServiceHost(typeof(FooService));
// I can add both endpoints here, but this is what gives me the error.
selfServiceHost.AddServiceEndpoint(typeof(IFooService), new NetTcpBinding(), serviceAddress);
selfServiceHost.AddServiceEndpoint(typeof(IBarService), new NetTcpBinding(), serviceAddress);
selfServiceHost.Open();
Console.ReadLine();
selfServiceHost.Close();
}
Run Code Online (Sandbox Code Playgroud)
这是客户端代码:
static void Main(string[] args)
{
NetTcpBinding netTcpBinding = new NetTcpBinding();
EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:8088/FooBarService");
// Call IFooService
var channelFactoryFoo = new ChannelFactory<IFooService>(netTcpBinding, …Run Code Online (Sandbox Code Playgroud) 所以有人建议使用WPF TreeView,我想:"是的,这似乎是正确的方法." 现在,几个小时后,我简直无法相信使用这个控件有多困难.通过一系列研究,我能够使TreeView`控件正常工作,但我找不到"正确"的方法来将所选项目添加到视图模型中.我不需要从代码中设置所选项目; 我只需要我的视图模型就可以知道用户选择了哪个项目.
到目前为止,我有这个XAML,它本身不是很直观.这都在UserControl.Resources标记内:
<CollectionViewSource x:Key="cvs" Source="{Binding ApplicationServers}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="DeploymentEnvironment"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
<!-- Our leaf nodes (server names) -->
<DataTemplate x:Key="serverTemplate">
<TextBlock Text="{Binding Path=Name}"/>
</DataTemplate>
<!-- Note: The Items path refers to the items in the CollectionViewSource group (our servers).
The Name path refers to the group name. -->
<HierarchicalDataTemplate x:Key="categoryTemplate"
ItemsSource="{Binding Path=Items}"
ItemTemplate="{StaticResource serverTemplate}">
<TextBlock Text="{Binding Path=Name}" FontWeight="Bold"/>
</HierarchicalDataTemplate>
Run Code Online (Sandbox Code Playgroud)
这是树视图:
<TreeView DockPanel.Dock="Bottom" ItemsSource="{Binding Source={StaticResource cvs}, Path=Groups}"
ItemTemplate="{StaticResource categoryTemplate}">
<Style TargetType="TreeViewItem">
<Setter Property="IsSelected" Value="{Binding Path=IsSelected}"/>
</Style>
</TreeView> …Run Code Online (Sandbox Code Playgroud) 在包含它们的类中编写代码时,使用私有字段或属性是一种好习惯吗?
例如,如果我有这个字段/属性对,则此类之外的类必须使用该属性.课堂内的代码怎么样?它应该使用私人领域,还是应该通过财产?
private string _foo;
protected string Foo
{
get { return this._foo; }
}
private void SomeMethod()
{
string dummyVariable = "snuh" + this._foo; // So, this...
string dummyVariable = "snuh" + this.Foo; // ... or this?
}
Run Code Online (Sandbox Code Playgroud)
在这里使用属性的一个优点是,如果getter中有任何逻辑,它仍然会被执行.我很想知道这里是否有最佳实践政策.
我有一个javascript函数,用JSON数据调用MVC控制器:
var specsAsJson = JSON.stringify(specs);
$.post('/Home/Save', { jsonData: specsAsJson });
Run Code Online (Sandbox Code Playgroud)
在服务器端,在控制器内,我似乎无法通过此错误:
/ Date(1347992529530)/不是DateTime的有效值.
当我调用Deserialize()(下面的方法中的第三行)时会发生异常:
public ActionResult Save(string jsonData)
{
var serializer = new JavaScriptSerializer();
serializer.RegisterConverters(new[] { new TimeSpanJsonConverter() });
var specs = serializer.Deserialize<List<EquipmentSpecWithParameterlessConstructor>>(jsonData);
return View("Index", _allTrackerJobs);
}
Run Code Online (Sandbox Code Playgroud)
我一直在做一些谷歌搜索,上面的代码是我最近尝试使这项工作(从这里使用TimeSpanJsonConverter ).其他方法显示只向服务器发送日期,但我有一个对象列表,其中日期作为一些属性.
是否有一种优雅的,普遍接受的方法来解决这个问题,还是我们还需要某种丑陋的解决方法?解决这个问题的正确方法是什么?
===================原始问题结束===================
编辑 - 通过使用JsonConvert序列化解决
请参阅下面的答案(不是这个问题中糟糕的解决方法).
编辑 - 糟糕的解决方法
我创建了一个DTO,其字段与域对象完全相同,只是我将日期字段设置为字符串,以便反序列化.现在我可以反序列化它,我将努力将日期转换为有效的格式,以便我可以从我的DTO创建域对象.
public class EquipmentSpecDto
{
public string StartTime { get; set; }
public string EndTime { get; set; }
// more properties here
}
Run Code Online (Sandbox Code Playgroud)
我只是使用DTO进行反序列化:
var specs = …Run Code Online (Sandbox Code Playgroud) 我刚刚将SSMS升级到2008 R2.我错过了从表中选择前1000行的选项,如下所示:

我看起来像这样:

我知道如何更改显示的行数,但选项根本不存在.几年前我看到有人提交了一个bug,但没有解决方法,我不知道该怎么做.有任何想法吗?
编辑 - Azure问题?
我刚刚使用SSMS打开我的本地SQL Server,我可以选择前100行.但在我的其他SSMS实例中,连接到我的Azure数据库的实例,我没有看到它.它可能是Azure限制吗?
我很难找到有关如何让RavenDB在网络上工作的信息.在同一个网络中,我可以运行我的应用程序实例,它将显示来自我的RavenDB的数据.但是,当我尝试写入数据时,我收到了401 Unauthorized异常.
设置要通过网络访问的RavenDB的正确方法是什么?
现在,我在Raven.Server.exe.config中有这个,这只是一个短期解决方案:
<add key="Raven/AnonymousAccess" value="All" />
Run Code Online (Sandbox Code Playgroud)
我不明白的是,RavenDB网站说使用这样的东西:
<connectionStrings>
<add name="RavenDb"
connectionString="Url=http://serverName:8080;user=user;password=password"/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
好的,这对正在运行的应用程序很有用,但是如何设置RavenDB服务器以允许该用户和密码?这是错误的做法(以某种方式设置RavenDB配置文件以允许这些凭据)?如果这是错的,我应该如何在服务器端定义凭据?
编辑:以下是我的尝试和结果:
我通过双击Raven.Server.exe来运行RavenDB.
场景1
客户端app.Config:
<connectionStrings>
<add name="RavenDb" connectionString="Url = http://server:8080;domain=Xx;user=Xx\user;password=pw"/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
DocumentStore设置:
DocumentStore documentStore = new DocumentStore();
documentStore.ConnectionStringName = "RavenDb";
documentStore.Initialize();
Run Code Online (Sandbox Code Playgroud)
保存操作:
Session.Store(objectToSave);
Run Code Online (Sandbox Code Playgroud)
结果:"远程服务器返回错误:(401)未经授权."
情景2
客户端app.config:
<add key="databaseUrl" value="http://server:8080"/>
Run Code Online (Sandbox Code Playgroud)
DocumentStore设置:
string databaseUrl = ConfigurationManager.AppSettings["databaseUrl"];
DocumentStore documentStore = new DocumentStore();
documentStore.Url = databaseUrl;
documentStore.Initialize();
Run Code Online (Sandbox Code Playgroud)
保存操作:
Session.Store(objectToSave);
Run Code Online (Sandbox Code Playgroud)
结果:"远程服务器返回错误:(401)未经授权." 内部异常:"目标主体名称不正确"
c# ×6
wcf ×3
angularjs ×1
azure ×1
datacontract ×1
github ×1
javascript ×1
json ×1
known-types ×1
mvvm ×1
ng-grid ×1
oop ×1
properties ×1
ravendb ×1
selecteditem ×1
sql-server ×1
ssms ×1
stringify ×1
treeview ×1
wpf ×1