Accessing ORACLE with SQL SERVER generated Business Object (Problem)


Author
Message
Ertan Deniz
Ertan Deniz
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 163, Visits: 493
My need is very clear. I want to support both ORACLE and SQL SERVER at the runtime over single business object in my project. I've read linked post. Trent has said that

"The BOs do not know or care about where the data comes from.  The only time that you will have an issue in regards to the BO is if you are creating custom queries (SqlCommand / OracleCommand) and then executing that command via a FillTableThe BOs do not know or care about where the data comes from.  The only time that you will have an issue in regards to the BO is if you are creating custom queries (SqlCommand / OracleCommand) and then executing that command via a FillTable"

 http://forum.strataframe.net/Topic16974-6-1.aspx

So, I've worked on a few days to be successful on my requirement. Generating business objects from two data sources and manage the true instance complicates my work. It is not acceptable.

If there will be a solution, it have to be developed easily.

What should I do ? Does strataframe solves my requirement ? Please respond quickly.

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, so the business object was built against a SQL Server table through the business object mapper, but you're using ORACLE to populate the business object at runtime? 

If so, then there's you're problem.  When you build the business object against a database at design-time, then it's highly recommended that you execute the business object against the same database type at runtime.  So, if you use the BOMapper to build the schema against the ORACLE table, then all of those Int columns will be changed to System.Decimal instead.  Then, your code that accesses the business object can worry about the type conversions.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'd suggest using the custom code area in the BO mapper. Then it won't get overwritten.
Ertan Deniz
Ertan Deniz
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 163, Visits: 493
But Business Object is generated based on SQL SERVER table.

The cast operation was generated by StrataFrame. If I change the cast operation to System.Convert.ToInt32(), next generation will overwrite.

What can I do in this case ?

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (938 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
All numbers in Oracle are stored as floating point numbers, so they come out as decimal. To ensure that you can return it as an integer, use the System.Convert.ToInt32() method instead of casting it as an integer.
Ertan Deniz
Ertan Deniz
StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)StrataFrame User (207 reputation)
Group: Forum Members
Posts: 163, Visits: 493
Business Object was filled from ORACLE. (Table)

But When I 'm trying to access "id" property getting the error "specified cast is not valid".

Id property (Int32), Datatable.Column.type is System.Decimal. (ORacle table column is NUMBER").

I've run the query through FillDataTable("Select statement") command.

public System.Int32 id

{

get

{

return (System.Int32)this.CurrentRow["id"];

}

set

{

this.CurrentRow["id"] = value;

}

}

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search