Friday, June 13, 2008
Dim s As String
s = dsCustomersOrders1.Customers(0).CustomerID
In contrast, if we are working with an untyped DataSet, the equivalent code looks like this:
Dim s As String s = CType ( dsCustomersOrders1.Tables ( "Customers" ). Rows(0). Item
As the syntax is much simpler and more practical, using typed Datasets is much more handy.
When a .NET client activates a COM object, the runtime generates an instance of the runtime callable wrapper (RCW) to wrap the COM type. As the following illustration shows, the runtime uses metadata obtained from an imported COM type library to generate the RCW. The wrapper marshals data according to the rules established by the interop marshaling service.
There are two ways to customize an RCW. If you can modify the Interface Definition Language (IDL) source, you can apply type library file (TLB) attributes and import the type library. Alternatively, you can apply interop-specific attributes to imported types and generate a new assembly. Support for customizing standard RCWs is limited by these attributes.
To modify the IDL source
1. Apply TLB attributes to libraries, types, members, and parameters. Use the custom keyword and an attribute value to change metadata. By applying TLB attributes, you can:
· Specify the managed name of an imported COM type, instead of allowing the import utility to select the name according to standard conversion rules.
· Explicitly define a destination namespace for the types in a COM library.
2. Compile the IDL source code.
3. Generate an assembly from the resulting type library file or from a dynamic link library file (DLL) that contains the type you intend to implement.
To modify an imported assembly
1. Import the type library file. Use the Type Library Importer (Tlbimp.exe) to generate an assembly DLL.
2. Create a text file from the imported assembly by using the MSIL Disassembler (Ildasm.exe).
3. Apply interop attributes to the text file.
4. Generate a new assembly from the modified text file by using the MSIL Assembler (Ilasm.exe).
A COM callable wrapper (CCW) exposes .NET Framework objects to COM. By compiling a managed project into an assembly DLL, you automatically create the metadata required to describe each type in the assembly. The runtime uses this metadata to generate a CCW whenever a COM client activates managed object.
To customize a CCW, apply interop-specific attributes to your managed source code and compile the source into an assembly, as shown in the following illustration. In this example, Tlbexp.exe converts managed types to COM.
CCW generation and method calls
By applying attributes to your code, you can alter interface and data marshaling behavior within the confines of the interop marshaling service. For example, you can control the format of the data passed as an argument to a method. You can also control which types in an assembly are exposed to COM.
Using a Virtual Private Network (VPN) is the most secure option for implementing replication over the Internet. VPNs include client software so that computers connect over the Internet (or in special cases, even an intranet) to software in a dedicated computer or a server. Optionally, encryption at both ends as well as user authentication methods keep data safe. The VPN connection over the Internet logically operates as a Wide Area Network (WAN) link between the sites.
A VPN connects the components of one network over another network. This is achieved by allowing the user to tunnel through the Internet or another public network (using a protocol such as Microsoft Point-to-Point Tunneling Protocol (PPTP) available with the Microsoft® Windows NT® version 4.0 or Microsoft Windows® 2000 operating system, or Layer Two Tunneling Protocol (L2TP) available with the Windows 2000 operating system). This process provides the same security and features previously available only in a private network.