.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

ISerializable Support in Data Contracts

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :WCF
Hi, We are migrating a bunch of services that pass typed datasets to instead use data contracts.  The types translate to data contracts really well -- basic properties and collections of other data contract types.  And everything works fine -- except for binary serialization performance compared to typed datasets.  Datasets have a pretty well-optimized serialization mechanism so we went to work and implemented ISerializable for our data contracts.  That custom serialization meets or beats the dataset serialization, so we are happy about that. The problem is that you can't have a type decorated with the DataContract attribute that also implements ISerializable.  I was hoping there was some way to host a netTcp binding that would use our custom serialization while also being able to host the same service using Http and the regular Data Contract Serializer (and other WCF interop goodness).  But if a data contract can't implement ISerializable, then I have to duplicate my types (and therefore my contracts) and figure out some wacky inheritance scheme to avoid duplicating the service code as well. Is there some way to configure a host to use a custom binary serializer (doesn't *have* to be ISerializable) while preserving the abilty to use the standard data contract features over Http? Thanks, -ErikErik Johnson

View Complete Post

More Related Resource Links

Under The Table: Spatial Data Support In SQL Server 2008


New spatial data support in SQL Server 2008 opens the door to mapping and querying geometric and geographic data, allowing you to build exciting new applications.

Bob Beauchemin

MSDN Magazine February 2009

ASP.NET AJAX 4.0: New AJAX Support For Data-Driven Web Apps


Here is an ASP.NET AJAX data-driven Web application that takes the best features from server- and client-side programming to deliver an efficient, user-friendly experience.

Bertrand Le Roy

MSDN Magazine October 2008

Data Points: SQL Server 2005 XML Support, Exception Handling, and More


SQL Server 2005 includes several important improvements to the Transact-SQL (T-SQL) language. One added feature is a new kind of trigger that fires when data definition language (DDL) statements run.

John Papa

MSDN Magazine May 2006

SQLXML 3.0: Build Data-Driven Web Services with Updated XML Support for SQL Server 2000


XML is becoming the ubiquitous data format on the Web, and XML support in SQL Server is evolving to meet the additional demand. Using XML, SOAP, HTTP, and SQL Server, you can now build powerful Web Services easily. To show just how simple it is with SQLXML 3.0, this article walks the reader through the process step by step, from setting up a virtual directory enabling data access via HTTP to executing queries and building Web Services. Finally, the author illustrates the creation of two Web Services clients-one with C# that works with the Microsoft .NET Framework and one with the SOAP Toolkit 2.0 for anyone still using earlier development tools.

Christian Thilmany

MSDN Magazine May 2002

Visual FoxPro 7.0: Program Your Data with Powerful New COM, XML, and Web Services Support


Visual FoxPro 7.0 represents a significant improvement over version 6.0. There are many new features designed to support COM, XML, and Web Services. Now COM servers built with Visual FoxPro are more flexible and robust thanks to strong typing and the ability to implement interfaces from other type libraries. IDE features like the new object browser combine convenience and efficiency, and other language features such as event handlers and early binding to COM objects increase performance. Lastly, an enhanced session class plus several new XML functions make Visual FoxPro a great choice for Web application development.

Erik Moore

MSDN Magazine October 2001

DataSet does not support System.Nullable<>. at System.Data.DataColumn.set_DataType(Type value)

Hi All, I'm populating array of objects into DataTable.  One of the field is of type date and my be null..Can't seem to fix it. can anyone help.. Thanks,-----------------------------------------------------------Employees[] e = Service.GetEmployee();Util.ConvertToDataTable(e);-----------------------------------------------------------error:Unhandled Exception: System.NotSupportedException: DataSet does not support System.Nullable<>. at System.Data.DataColumn.set_DataType(Type value)    

Hierachial data contracts and SQL


Can someone give me some suggestions here. We have a WCF service communicating with a SQL database using Linq to SQL. Now I don't want to use the auto-generated data types but want to design my own Data Contracts that I can have full control over.

But how should the data contracts be designed? I'll try to explain why I find this hard:

Let's say this database has 3 tables:

Table "Session":
Column "SessionID",
Column "Name"

Table "Client":
Column "ClientID",
Column "FirstName",
Column "LastName",
Column "SessionID"

Table "Message":
Column "MessageID",
Column "MessageText",
Column "ClientID"

So, each session can have multiple clients and each client can have multiple messages.

Now, when I create the data contracts that reflects this hierarchy, should I create data contracts with a "flat" hierarchy that looks like this:

public class Session
    public int SessionID { get; set; }

Data Contracts vs Message Contracts



I'm not sure when I should use a message contract.  In fact why would I use a message?  After all my operation parameters get serialized into a soap envelope automatically.

So when would I use a message and when would I use a serilizable class?

Thanks in advance


ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

Editing the Data in a GridView

In addition to deleting a GridView's underlying data, another common need is to allow end users to edit the data displayed in a GridView. With ASP.NET 1.x's DataGrid control, editing the data is certainly possible, but requires creating three event handlers and writing a dozen or so lines of code. With the GridView and ASP.NET 2.0, it is possible to create an editable GridView without writing a single line of code! All of the necessary functionality is encapsulated within the GridView.

The GridView allows editing on a row-by-row basis. An editable GridView contains an additional column with an Edit button in each row. When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become TextBoxes. The end user can then update one or more column values and click Update to save their changes.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

Displaying Data using ASP.NET 2.0 Repeater and C#

This tutorial will show you how to display data using the .NET Repeater Control, ASP.NET 2.0 and C#.NET

The Repeater control is a powerful tool and is easy to use.

First, you will need to import the System.Data.SqlClient namespace.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend