小编Out*_*per的帖子

如何确定web.config中的编译debug ="true"

我在这里画一个空白的东西应该很简单......

我想做的事情如下:

    <my:control runat="server" id="myid" Visible="<%= (is compilation debug mode?) %>" />
Run Code Online (Sandbox Code Playgroud)

c# asp.net debugging

30
推荐指数
3
解决办法
2万
查看次数

SQL Server(TSQL) - 是否可以并行执行EXEC语句?

SQL Server 2008 R2

这是一个简化的例子:

EXECUTE sp_executesql N'PRINT ''1st '' + convert(varchar, getdate(), 126) WAITFOR DELAY ''000:00:10'''
EXECUTE sp_executesql N'PRINT ''2nd '' + convert(varchar, getdate(), 126)'
Run Code Online (Sandbox Code Playgroud)

第一个语句将打印日期并在继续之前延迟10秒.第二个陈述应立即打印.

T-SQL的工作方式,第二个语句在第一个语句完成之前不会被评估.如果我将其复制并粘贴到新的查询窗口,它将立即执行.

问题是我还有其他更复杂的事情,需要传递给两个程序的变量.

我想要做的是:

  • 得到一个记录
  • 将其锁定一段时间
  • 当它被锁定时,对该记录和表本身执行一些其他语句

也许有一种方法可以动态创建几个工作?

无论如何,我正在寻找一种简单的方法来做到这一点,而无需手动PRINT语句和复制/粘贴到另一个会话.

有没有办法在没有等待/并行的情况下执行EXEC?

sql t-sql sql-server

14
推荐指数
2
解决办法
4万
查看次数

ListView 中的 WPF ListView

我确信我错过了一些简单/明显的东西,但我似乎无法在 ListView 中绑定 ListView 的数据

<Window x:Class="TestList.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <DataTemplate x:Key="InsideListTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="test" Width="50"></TextBlock>
            <TextBlock Text="{Binding OrderId}" Width="50"></TextBlock>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="OrdersTemplate">
        <ListView HorizontalAlignment="Stretch"
                  HorizontalContentAlignment="Stretch"
                  MinWidth="100"
                  MinHeight="25"
            ItemsSource="{Binding Orders}" 
            ItemTemplate="{StaticResource InsideListTemplate}" 
        >
        </ListView>
    </DataTemplate>
    <DataTemplate x:Key="CustomersTemplate">
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
            <TextBlock Text="{Binding CustomerId}" Width="50" Foreground="Navy" VerticalAlignment="Center" />
            <ListBox ItemsSource="{Binding Orders}" ItemTemplate="{StaticResource OrdersTemplate}" HorizontalContentAlignment="Stretch"></ListBox>
        </StackPanel>
    </DataTemplate>

</Window.Resources>
<DockPanel LastChildFill="True">
    <ListView Name="listView" ItemTemplate="{StaticResource CustomersTemplate}" >
    </ListView>
</DockPanel>
Run Code Online (Sandbox Code Playgroud)

using System.Collections.Generic;
namespace TestList
{
public partial class MainWindow
{ …
Run Code Online (Sandbox Code Playgroud)

data-binding wpf

6
推荐指数
1
解决办法
9890
查看次数

Visual Studio 2015 vNext和Windows身份验证

如何配置项目以使用Windows身份验证?既然没有web.config文件,我看不出怎么做.

我在Startup中看到app.UseIdentity(),但不知道如何在IIS Express中使用Windows Auth.当我尝试在IIS(Windows 7,IIS 7.5)中创建项目时,似乎没有.NET 4.6/4.5应用程序池我尝试使用.NET 4.0但出现错误:

无法确定要运行的适当版本的运行时.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=517742.

当然,这个链接并没有带给我信息,但是http://www.asp.net/

c# asp.net iis windows-authentication visual-studio-2015

6
推荐指数
2
解决办法
5035
查看次数

WCF与实体框架错误第二部分

新手,请耐心等待,因为我昨天刚开始与WCF合作.

我使用Northwind获取数据,只向模型中添加了客户,订单,订单详细信息和产品,因此没什么特别的.

当我启动应用程序并调用Test并设置断点时,产品的值就在那里,并且它完成且没有错误.如果我然后尝试调用GetMaxQuantityByOrderID(10248),我会在底部列出错误.为什么Test()工作和相同的方法WITHIN Test()不起作用?我甚至添加了另一个(Test1(),与Test完全相同,除了它返回字符串:x.ProductName,它正确显示了Queso Cabrales).在另一个方法中调用的方法有效,但直接调用它会导致异常,这似乎很奇怪.

我遇到的另一个问题是IEnumerable GetOrders()仅在我添加.ToList()时才有效.如果没有它(或使用.AsEnumerable()),我会收到一个错误(ObjectContext实例已被释放,不能再用于需要连接的操作.),即使延迟加载设置为False.这背后的逻辑是什么?

IServiceTest.cs

using System.Collections.Generic;
using System.ServiceModel;

namespace WcfTestServiceLibrary
{
    [ServiceContract]
    public interface IServiceTest
    {

        [OperationContract]
        IEnumerable<Orders> GetOrders();

        [OperationContract]
        IEnumerable<Customers> GetCustomers();

        [OperationContract]
        Customers GetCustomerByID(string customerID);

        [OperationContract]
        Orders GetOrderByID(int id);

        [OperationContract]
        IEnumerable<Order_Details> GetOrderDetailsByOrderID(int id);

        [OperationContract]
        Order_Details GetMaxQuantityByOrderID(int id);

        [OperationContract]
        void Test();
    }
}
Run Code Online (Sandbox Code Playgroud)

ServiceTest.cs

using System.Collections.Generic;
using System.Linq;

namespace WcfTestServiceLibrary
{

    public class ServiceTest : IServiceTest
    {
        public IEnumerable<Orders> GetOrders()
        {
            using (var ctx = new NWEntities()) …
Run Code Online (Sandbox Code Playgroud)

wcf entity-framework

5
推荐指数
2
解决办法
3771
查看次数

decimal.parse("value")似乎很奇怪

我正在处理其他人的代码,并看到如下内容:

if ((somevariable) >  decimal.Parse("24,999.99")) ...
Run Code Online (Sandbox Code Playgroud)

return int.Parse("0");
Run Code Online (Sandbox Code Playgroud)

我想不出任何合乎逻辑的理由而不是

if ((somevariable) > 24999.99) ...
Run Code Online (Sandbox Code Playgroud)

要么

return 0;
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

c#

4
推荐指数
2
解决办法
187
查看次数

C#自定义控件来呈现其他控件

如何使用自定义控件呈现其他控件?显然,在渲染阶段,为时已晚.测试工作,因为它不包含<asp:sometag>,但test2是我想要写出来并正确呈现

 protected override void Render(HtmlTextWriter writer)
        {
            const string test = @"<a href='http://www.something.com'></a>";
            const string test2 = "<asp:HyperLink ID='HyperLink1' runat='server' NavigateUrl='www.something.com'>Some Text</asp:HyperLink>";

            writer.Write(test2);
        }
Run Code Online (Sandbox Code Playgroud)

c# asp.net rendering custom-controls

2
推荐指数
1
解决办法
1864
查看次数