пятница, 1 февраля 2013 г.

как открыть csv в asp

SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/csv"));

public class CSVMediaTypeFormatter : MediaTypeFormatter {

First of all we need to create a class which will be derived from abstract class. Here is the class with its constructors:

I wanted to create CSVMediaTypeFormatter to hook it up for list of objects and I managed to get it working. After I created it, I saw the great post on ASP.NET web site which does the same thing. I was like "Man, come on!" and I noticed that formatter meant to be used with a specific object, so I figured there is still a validity in my implementation.

As I tried to explain on my previous post, formatters play a huge role inside the ASP.NET Web API processing pipeline. As Web API framework programming model is so similar to MVC framework, I kind of want to see formatters as views. Formatters handles serializing and deserializing strongly-typed objects into specific format.

In this post, we will see how to create a custom CSVMediaTypeFormatter in ASP.NET Web API for comma-separated values (CSV) format

Creating Custom CSVMediaTypeFormatter In ASP.NET Web API for Comma-Separated Values (CSV) Format

Creating Custom CSVMediaTypeFormatter In ASP.NET Web API for Comma-Separated Values (CSV) Format

Комментариев нет:

Отправить комментарий