Csla and Oracle

Csla and Oracle

Old forum URL: forums.lhotka.net/forums/t/2726.aspx


Nika posted on Wednesday, April 18, 2007

I try to use Csla framework with Oracle database. I created web application and try to establish connection using Enterprise Services (created and registered dll) but in execution time I have error message “Could not load file or assembly 'EnterpriseServicesHostvbora' or one of its dependencies. The system cannot find the file specified”

That error was in Csla\DataPortal\Client\DataPortal.vb   

Line 417: mPortal = DirectCast(Activator.CreateInstance(assemblyName, _
Line 418:            typeName).Unwrap, DataPortalClient.IDataPortalProxy) 

Is somebody use csla framework with Oracle database? What is the best way?

 

Thank you.

 

JoeFallon1 replied on Wednesday, April 18, 2007

I use Oracle and SQL Server.

You do NOT need Enterprise Services at all.

Just set a reference to System.Data.OracleClient and you can use all the same features that SqlClient uses.

SqlCommand       OracleCommand

SqlConnection    OracleConnection

SqlDataAdapter  OracleDataAdapter

SqlParameter        OracleParameter

Nika replied on Wednesday, April 18, 2007

Thank you,

I use OracleClient and also I start to use Oracle.NET tool for Microsoft Visual Studio.

But I like to use Csla feturs and get result (ref cursor) from Oracle procedure using

Return DataPortal.Fetch(Of PrList)(New Criteria).

 

Can I use this functionalily?

 

 

Yang replied on Wednesday, April 18, 2007

You can use that functionality. The usage of CSLA should not be any different by using Oracle.

Nika replied on Wednesday, April 18, 2007

Thank you, for your help.

I use Oracle 10g and Oracle Data Privider for .NET.

I created sample project and I do not have any connection problem.

Only problem I have when try to get result using Csla functionallity.

And also I like to know how you control transuctions.  

Yang replied on Wednesday, April 18, 2007

that depends on what you want to accomplish. You can check out the System.Transactions if you want to be fancy. I believe in Oracle, this will be a COM+ transaction and will incur some overhead. If you use SQLServer 2005, this works great. For me, I just implement friend save methods in my child business objects that accepts a DBTransaction parameter and an instance of the DAAB Database and handle the commit and rollback from the parent business list object.

Nika replied on Friday, April 20, 2007

I like to share my experience working with Csla and Oracle.

Unfortunately class SafeDataReader does not suport Oracle data type.

I was able to get result from Oracle RefCursor only with OracleDataReader.

I have another problem to visualize all result in GridView control. For example I have 400 records and need to use paging. Is CslaDataSource support paging in interface level?

 

 

 

 

RockfordLhotka replied on Friday, April 20, 2007

In version 2.1.4, CslaDataSource allows you to implement paging in the GridView control, in the SelectObject event handler, in your object's factory method, in your object's DataPortal_Fetch method or in a stored procedure (or other database construct). You can choose which location is the most efficient for your particular requirements.

Nika replied on Friday, April 20, 2007

Thank you,

It was very easy.

I used SelectObject event to populate business object and created small procedure DisplayCurrentPage and called from

GridView1_PageIndexChanged and GridView1_SelectedIndexChanged events.

 

Sub DisplayCurrentPage()

        Dim i As Integer

 

        GridView1.DataBind()

        If GridView1.PageCount > 0 Then

            For i = 0 To GridView1.PageCount - 1

                Dim pageNumber As Integer = i + 1

                Dim item As ListItem = New  ListItem(pageNumber.ToString())

                If i = GridView1.PageIndex Then

                    item.Selected = True

                End If

            Next i

            Dim currentPage As Integer = GridView1.PageIndex + 1

            Me.Label5.Text = "Page " & currentPage.ToString & " of " & GridView1.PageCount.ToString

        End If

 

    End Sub

 

Yang replied on Wednesday, April 18, 2007

What version of Oracle are you using? I believe that if you use version 9 and up you can use ODP.NET (Oracle Data Provider for .NET). This is provided by Oracle and is "supposed" to be better than the one provided by Microsoft. I use the Microsoft's Ent Lib Data Access Block where we have a custom Database Class to handle ODP.NET driver.

Copyright (c) Marimer LLC