- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Csla.Server.IDataPortalServer in VB.NET
Csla.Server.IDataPortalServer Printing PDF417 In Visual Basic .NET Using Barcode drawer for .NET framework Control to generate, create PDF417 image in Visual Studio .NET applications. www.OnBarcode.comScanning PDF-417 2d Barcode In VB.NET Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comEach channel comes in two parts: a proxy on the client and a host on the server. Csla.DataPortal calls the proxy, which in turn transfers the call to the host by using its channel. The host then delegates the call to a Csla.Server.DataPortal object. To ensure that all the parts of this chain can reliably interact, there are two interfaces: Csla.Server.IDataPortalServer and Csla. DataPortalClient.IDataPortalProxy. Code 128C Printer In Visual Basic .NET Using Barcode creation for VS .NET Control to generate, create Code-128 image in VS .NET applications. www.OnBarcode.comQR Code ISO/IEC18004 Generation In Visual Basic .NET Using Barcode encoder for .NET Control to generate, create QR Code image in .NET framework applications. www.OnBarcode.comCHAPTER 4 s DATA ACCESS AND SECURITY
UPC - 13 Creation In VB.NET Using Barcode maker for .NET framework Control to generate, create EAN 13 image in Visual Studio .NET applications. www.OnBarcode.comBarcode Printer In Visual Basic .NET Using Barcode encoder for Visual Studio .NET Control to generate, create Barcode image in .NET framework applications. www.OnBarcode.comThe IDataPortalServer interface defines the methods common across the entire process: Public Interface IDataPortalServer Function Create( _ ByVal objectType As Type, _ ByVal criteria As Object, _ ByVal context As DataPortalContext) Function Fetch( _ ByVal criteria As Object, _ ByVal context As DataPortalContext) Function Update( _ ByVal obj As Object, _ ByVal context As DataPortalContext) Function Delete( _ ByVal criteria As Object, _ ByVal context As DataPortalContext) End Interface Painting PDF417 In Visual Basic .NET Using Barcode creation for VS .NET Control to generate, create PDF 417 image in Visual Studio .NET applications. www.OnBarcode.comMake ISSN - 10 In Visual Basic .NET Using Barcode creator for .NET Control to generate, create ISSN - 10 image in VS .NET applications. www.OnBarcode.comAs DataPortalResult
Reading PDF 417 In None Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comPDF-417 2d Barcode Generation In None Using Barcode encoder for Font Control to generate, create PDF 417 image in Font applications. www.OnBarcode.comAs DataPortalResult
GS1 - 12 Creator In Java Using Barcode creator for Java Control to generate, create UPC Code image in Java applications. www.OnBarcode.comRecognizing Data Matrix ECC200 In Java Using Barcode decoder for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comAs DataPortalResult
Matrix 2D Barcode Generation In Java Using Barcode creation for Java Control to generate, create Matrix 2D Barcode image in Java applications. www.OnBarcode.comGenerate DataMatrix In None Using Barcode generator for Font Control to generate, create Data Matrix 2d barcode image in Font applications. www.OnBarcode.comAs DataPortalResult
Encoding UPC-A Supplement 5 In Java Using Barcode maker for Eclipse BIRT Control to generate, create UPC Symbol image in BIRT reports applications. www.OnBarcode.comPDF-417 2d Barcode Generation In C# Using Barcode drawer for .NET framework Control to generate, create PDF 417 image in .NET framework applications. www.OnBarcode.comNotice that these are the same method signatures as implemented by the methods in Csla.DataPortal, making it very easy for that class to delegate its calls through a proxy and host all the way to Csla.Server.DataPortal. Barcode Maker In None Using Barcode printer for Software Control to generate, create Barcode image in Software applications. www.OnBarcode.comBarcode Generation In .NET Framework Using Barcode encoder for .NET framework Control to generate, create Barcode image in .NET applications. www.OnBarcode.comCsla.DataPortalClient.IDataPortalProxy
Create DataMatrix In None Using Barcode creation for Software Control to generate, create Data Matrix ECC200 image in Software applications. www.OnBarcode.comMaking Code 128 Code Set A In Visual Studio .NET Using Barcode generation for Reporting Service Control to generate, create Code128 image in Reporting Service applications. www.OnBarcode.comAll the proxy classes implement a common Csla.DataPortalClient.IDataPortalProxy interface so they can be used by Csla.DataPortal. This interface inherits from Csla.Server.IDataPortalServer, ensuring that all proxy classes will have the same methods as all server-side host classes: Public Interface IDataPortalProxy Inherits Server.IDataPortalServer ReadOnly Property IsServerRemote() As Boolean End Interface In addition to the four data methods, proxy classes need to report whether they interact with an actual server-side host or not. As you ll see, at least one proxy interacts with a client-side host. Recall that in Csla.DataPortal, the IsServerRemote property was used to control whether the context data was set and restored. If the server-side code is running inside the client process, then much of that work can be bypassed, improving performance. Csla.DataPortalClient.LocalProxy
The default option for a network channel is not to use the network at all, but rather to run the server-side code inside the client process. This option offers the best performance, though possibly at the cost of security or scalability. The various trade-offs of n-tier deployments were discussed in 1. Even when running the server-side code in-process on the client, the data portal uses a proxy for the local channel : Csla.DataPortalClient.LocalProxy. As with all proxy classes, this one implements the Csla.DataPortalClient.IDataPortalProxy interface, exposing a standard set of methods and properties for use by Csla.DataPortal. Because this proxy doesn t actually use a network protocol, it is the simplest of all the proxies: CHAPTER 4 s DATA ACCESS AND SECURITY
Public Class LocalProxy Implements DataPortalClient.IDataPortalProxy Private mPortal As Server.IDataPortalServer = _ New Server.DataPortal Public Function Create( _ ByVal objectType As System.Type, ByVal criteria As Object, _ ByVal context As Server.DataPortalContext) As Server.DataPortalResult _ Implements Server.IDataPortalServer.Create Return mPortal.Create(objectType, criteria, context) End Function Public Function Fetch( _ ByVal criteria As Object, _ ByVal context As Server.DataPortalContext) As Server.DataPortalResult _ Implements Server.IDataPortalServer.Fetch Return mPortal.Fetch(criteria, context) End Function Public Function Update( _ ByVal obj As Object, _ ByVal context As Server.DataPortalContext) As Server.DataPortalResult _ Implements Server.IDataPortalServer.Update Return mPortal.Update(obj, context) End Function Public Function Delete( _ ByVal criteria As Object, _ ByVal context As Server.DataPortalContext) As Server.DataPortalResult _ Implements Server.IDataPortalServer.Delete Return mPortal.Delete(criteria, context) End Function Public ReadOnly Property IsServerRemote() As Boolean _ Implements IDataPortalProxy.IsServerRemote Get Return False End Get End Property End Class All this proxy does is directly create an instance of Csla.Server.DataPortal: Private mPortal As Server.IDataPortalServer = _ New Server.DataPortal Each of the data methods (Create(), Fetch(), etc.) simply delegates to this object. The result is that the client call is handled by a Csla.Server.DataPortal object running within the client AppDomain and on the client s thread. Due to this, the IsServerRemote property returns False. CHAPTER 4 s DATA ACCESS AND SECURITY
Csla.DataPortalClient.RemotingProxy
More interesting is the .NET Remoting channel. This is implemented on the client by the RemotingProxy class, and on the server by the RemotingPortal class. When Csla.DataPortal delegates a call into RemotingProxy, it uses .NET Remoting to pass that call to a RemotingPortal object on the server. That object then delegates the call to a Csla.Server.DataPortal object. Because .NET Remoting automatically serializes objects across the network, the RemotingProxy class is not much more complex than LocalProxy: Public Class RemotingProxy Implements DataPortalClient.IDataPortalProxy #Region " Configure Remoting " Shared Sub New() ' create and register a custom HTTP channel ' that uses the binary formatter Dim properties As New Hashtable properties("name") = "HttpBinary" If ApplicationContext.AuthenticationType = "Windows" Then ' make sure we pass the user's Windows credentials ' to the server properties("useDefaultCredentials") = True End If Dim formatter As New BinaryClientFormatterSinkProvider Dim channel As New HttpChannel(properties, formatter, Nothing) ChannelServices.RegisterChannel(channel, EncryptChannel) End Sub Private Shared ReadOnly Property EncryptChannel() As Boolean Get Dim encrypt As Boolean = _ (ConfigurationManager.AppSettings("CslaEncryptRemoting") = "true") Return encrypt End Get End Property #End Region Private mPortal As Server.IDataPortalServer Private ReadOnly Property Portal() As Server.IDataPortalServer Get If mPortal Is Nothing Then mPortal = CType( _ Activator.GetObject(GetType(Server.Hosts.RemotingPortal), _ ApplicationContext.DataPortalUrl.ToString), _ Server.IDataPortalServer) End If Return mPortal End Get End Property
|
|