0

Am working on a business layer for a complex web application and am temporary using the Dynamic Data Site functionality to allow data to be entered into the many tables that I need to maintain. I don't want to spend too much time on this DDS since the business layer needs to be finished first. Once the business layer is done, it gets shipped to someone else to add a better user interface.

However, while the DDS offers a lot of functionality in a very easy way, I just want to extend it with an "Export to XML" button or link. (And I'll probably will add an "Export to Excel" button later.)

So, has anyone done something like this already? What would be the easiest way to implement this in .NET, without rewriting the DDS?

(I use an Entity model for the database connection and much of the business layer is built upon this entity model. Once the business layer is finished, the real GUI interface will be developed for this web application but for now I just need a good way to input/output this data.)


I have no problems converting an entity set to XML. That's the easy part. My problem lies in expanding "ListDetails.aspx" with an additional button which the user can click. Once clicked, it should export the dataset to XML. To make it interesting, if the user has set one or more filters, it should only export those filtered records. I think I'll have to look into the "GridDataSource" object that's on this page and experiment with it. Will it return the whole table or just the filtered dataset? Or just the records that are on the current page?


Now, with export, I just want a dump of the dataset to XML. Basically, what you see should end up in the final XML. If I have access to the filtered dataset then creating the XML would be easy. (And creating the Excel sheet on top of that is a piece of cake too.) In general, the export is just used to help develop the business layer of a project I'm working on. Most of the code is business logic that will be used in other (web/desktop) client applications but while the project is still in progress, the DDS is needed for easier data entry for the project. Once it's finished (a gazillion years from now, I guess) then the DDS won't be used anymore. Nor would we use the XML exports or the export sheets. But for now, those exports are useful to evaluate the data. (Since I still have to develop the more complex analysis tools.)

4

2 に答える 2

0

たぶん、 FileHelpersで何かをすることができます。

于 2009-06-18T07:49:23.687 に答える
0

これはかなり簡単です。いくつかの問題に対処する必要があります。

  • エクスポートをトリガーする手段を提供する
  • XML の生成
  • XML を (リンクとして) ダウンロードできるようにする - それがあなたのやりたいことだと仮定します。

XML を生成して返すサービスを作成するという、やや単純ではない代替手段があります。

最初の点については、マスター ページまたは既定のページを編集して、独自の機能 (ボタンまたは XML 生成ページへのリンク) を追加することを妨げるものは何もありません。

2 つ目については、Linq を使用すると、Entity モデルから XML を生成することがほとんど簡単になります。

XML を取得したら、さまざまなオプションがあります。ここで重要なのは、必要に応じてサイトに独自のページを追加できることです。動的データの魔法は、最終製品ではなく単なる出発点です (ただし、必要なものはすべて、笑顔で立ち去ることができます)。

これらは一般的な回答ですが、かなり一般的な質問であり、実装の詳細については、より具体的なページで対処することをお勧めします。

具体的には、XML を生成する必要がある動的データ サイトがあります。最初の繰り返しは、ファイルをディスクに保存するデフォルト ページのボタンでした (1 つのファイル名、1 つのファイル形式、クリック、生成、保存、完了) )。XML の理由は別のサイトのソース データだったので、同じ XML を公開する WCF サービスを追加しました。費やされた合計時間 (WCF に頭を悩ませるには少し少ない) は、おそらく半日未満です。そのほとんどは、XML 出力をいじるのに費やされています。

于 2009-06-18T08:13:31.983 に答える