私はDelphiXE2で書かれた.Net WebServiceとスタンドアロンアプリケーションを持っています。リストデータを圧縮するC#WebサービスDelphiでスタンドアロンクライアントに送信
多くのアイテム(400)を含むリストを提出すると、FindAllEntity()
メソッドが非常に遅くなります。
リストのデータコンポーネントを圧縮することを研究しましたが、ファイルとイメージを圧縮するために使用されるGzip C#しか見つかりませんでした。
スタンドアロンアプリケーションにすぐに送信できるデータのリストを圧縮する方法はありますか?ここで
はコードです:
//MyRegularNewEntity
public class _MyEntity
{
public decimal id { get; set; }
public _otherEntity Customers { get; set; }
public string serial { get; set; }
public decimal cost { get; set; }
}
//My Controller
public IQueryable<c#ModelEntity> GetAllDatOfEntity()
{
IQueryable<C#ModelEntity> Dat;
//The containt of data base entity is save in Dat ListQueryable
Dat = db.MyEntity;
return Dat;
}
//My WebService
[WebMethod]
public List<_MyRegularEntity> FindAllEntity()
{
//Construct my repository
MyRepository ag = new MyRepository();
//Asign the result in a variable of call to get all the dat
var Dat = ag. GetAllDatOfEntity();
//Contruct the List with my entity to send for my client
List<_MyRegularEntity> list = new List<_MyRegularEntity>();
//Add all dat element to my list
if (Dat != null)
{
foreach (var item in Dat)
{
var MyEntity = new _MyRegularEntity();
MyEntity.id = item.id,
MyEntity.Custormers = new _otherEntity()
{
id=item.Customers.id,
firstname=item.Customers.firstname,
lastname=item.Custormers,lastname
},
MyEntity.Serial = item.Serial,
MyEntity.Cost = item.Cost
list.Add(MyEntity);
};
}
//THIS IS THE RESULT I NEED COMPRESS
return list;
}
ASMX Webサービスは従来の技術であり、新しい開発に使用しないでください。 WCFは新しい開発に使用する必要があります。 –
私は同意しません... ASMXの部分ではなく、あなたはそうしてはいけません。むしろ、一般的なハンドラ(.ashx)はWCFとの格闘よりはるかに優れていることがわかりました。 – NotMe