小编Cha*_*had的帖子

"DbProviderFactories"部分每个配置文件只能出现一次

使用实体框架调用WCF .net 4.0服务时,我们收到此错误.

The 'DbProviderFactories' section can only appear once per config file
Run Code Online (Sandbox Code Playgroud)

它是使用EF和其他.net 4.0 WCF服务的服务器上的第一个应用程序没有收到此错误.

有没有办法纠正这个错误,而无需在服务器上编辑机器配置文件?

wcf iis-7 entity-framework-4 machine.config

9
推荐指数
2
解决办法
9337
查看次数

关系从一对多变为多对多需要更新listview

我有一个分发表,其中包含一个分配ID的pk和一个收件人表,其中RecipientID为pk.此表曾经是1对多,但现在需要使用中间表更改为多对多.

我有一个EntityDataSource,它提供了一个listview,允许简单地操作分发列表.

<asp:EntityDataSource ID="edsRecipients" runat="server" ConnectionString="name=DistributionEntities" DefaultContainerName="DistributionEntities" 
                        EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="Recipients"
                        Where="it.[DistributionID]=@DistributionID">
    <WhereParameters>
        <asp:ControlParameter ControlID="ddlSelectDistributionList" ConvertEmptyStringToNull="true" DbType="Int32" Name="DistributionID" />
    </WhereParameters>
</asp:EntityDataSource>  
Run Code Online (Sandbox Code Playgroud)

有没有办法可以更改where子句以使用新表如果需要,新表将命名为DistributionRecipients.如果没有,我可以通过某种方式将EF类的Distribuion.Recipients绑定到后面代码中的List视图,它将使用自动编辑和删除功能,还是需要添加代码来处理它们?

asp.net listview entity-framework entitydatasource entity-framework-4

5
推荐指数
1
解决办法
393
查看次数

我可以编写一个有条件表选择的查询

我们有2个具有相同结构的表,并且基于一个变量,我想选择要选择的表,而不必在我的过程中编写2个查询.

这可能吗?

我试过了

declare @table int
set @table = 1 

Select orderID, Quantity 
from case when @table = 1 then tblOrders else tblSubscriptionOrders end
where filled = 0
Run Code Online (Sandbox Code Playgroud)

但那没用

sql sql-server

5
推荐指数
3
解决办法
4777
查看次数

如何使用显式类实现接口类型

我有以下接口:

public interface IReplaceable
{
    int ParentID { get; set; }

    IReplaceable Parent { get; set; }
}

public interface IApproveable
{
    bool IsAwaitingApproval { get; set; }

    IApproveable Parent { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我想在类中实现它,如下所示:

public class Agency :  IReplaceable, IApproveable
{
     public int AgencyID { get; set; }
     // other properties

     private int ParentID { get; set; }

     // implmentation of the IReplaceable and IApproveable property
     public Agency Parent { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

有什么方法可以做到这一点吗?

c# interface

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