Interview Tips Interview Tips, Interview Questions and Answers

11Jul/100

How to save data from dataset?

The modified data needs to be sent back to the database in order to save it. Therefore, to send the modified data to a database, the Update method of a TableAdapter or data adapter needs to be called. The Update method executes either of INSERT, UPDATE, or DELETE depending on the RowState in the table.

In Visual Studio a TableAdapterManager component is used for saving the proper order based on the foreign-key constraints of the database.

Although the procedure to save the data may change depending upon the applications, the following steps throw light on the generalized concept:

The code sends updates to the database should be written within a try/catch block.

The data row should be located to determine the problem area and the code should then be reattempted.

16May/100

.NET Object Serialization – How can I optimize the serialization process?

How can I optimize the serialization process?

The first call to a Web Service takes long because XmlSerializer generate an assembly optimized for each type in memory.

To optimize the serialization process pregeneration of serialization assembly with Visual Studio or sgen.exe is needed.

Implementing serialization separately can also increase the performance.

What is Formatters? Explain the binary formatter and the SOAP formatter.

A formatter determines the serialization format for objects.

.NET framework provides Binary formatter and SOAP formatter which inherit from the IFormatter interface

The Binary Formatter

It provides binary encoding for compact serialization for storage or socket-based network streams.
It is not appropriate for data to be passed through a firewall.

The SOAP Formatter

It provides formatting that can be used to enable objects to be serialized using the SOAP protocol.
The class is used for serialization through firewalls or diverse systems.