小编Ars*_*bal的帖子

如何将包含PDF文件数据的两个内存流合并为一个

我试图将两个PDF文件读入两个内存流,然后返回一个包含两个流数据的流.但我似乎不明白我的代码有什么问题.

示例代码:

string file1Path = "Sampl1.pdf";
string file2Path = "Sample2.pdf";
MemoryStream stream1 = new MemoryStream(File.ReadAllBytes(file1Path));
MemoryStream stream2 = new MemoryStream(File.ReadAllBytes(file2Path));
stream1.Position = 0;
stream1.Copyto(stream2);
return stream2;   /*supposed to be containing data of both stream1 and stream2 but contains data of stream1 only*/  
Run Code Online (Sandbox Code Playgroud)

c# memorystream itextsharp

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

实体框架交换导航属性

我将EF与DB first方法一起使用。更新EDMX文件时遇到问题。假设我有一个表InvoiceT和另一个表LookupT。现在,在InvoiceT中,我有一列InvoiceType与LookupT具有FK关系。现在,实体在InvoiceT类中创建了名为LookupT的导航属性。到目前为止,它很好。

现在,我添加了名为InvoiceStatus的另一列和带有LookupT的FK。现在,实体创建了另一个名为LookupT1的导航属性。但是这里的问题是,第一个导航属性LookupT没有指向其原始数据,即InvoiceType。相反,它现在指向InvoiceStatus数据。有人可以向我解释为什么它会这样,我该怎么办?

public class InvoiceT
{
    public int InvoiceId {get;set;}
    public int InvoiceStatusLkpId {get;set;}
    public int InvoiceTypeLkpId {get;set;}
    public virtual LookupT LookupT {get;set;}    // Previously pointing to Type. Now to Status.
    public virtual LookupT LookupT1 {get;set;}    // Pointing to Type

}

public class LookupT
{
    public int LookupId {get;set;}
    public string LookupValue {get;set}
    public virtual ICollection<InvoiceT> InvoiceT {get;set;}
    public virtual ICollection<InvoiceT> InvoiceT1 {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

.net asp.net entity-framework edmx edmx-designer

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