| | | StrataFrame User
       
Group: StrataFrame Users Last Login: 11/12/2008 2:33:56 AM Posts: 152, Visits: 460 |
| | 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; } } |
| | | | StrataFrame Team Member

Group: StrataFrame Users Last Login: Yesterday @ 9:49:32 AM Posts: 215, Visits: 472 |
| | 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. |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 11/12/2008 2:33:56 AM Posts: 152, Visits: 460 |
| | 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 ? |
| | | | StrataFrame VIP
       
Group: StrataFrame Users Last Login: Yesterday @ 10:03:03 PM Posts: 1,322, Visits: 3,439 |
| | I'd suggest using the custom code area in the BO mapper. Then it won't get overwritten. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 10/21/2008 9:20:58 AM Posts: 2,685, Visits: 1,887 |
| | 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.
www.bungie.net |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 11/12/2008 2:33:56 AM Posts: 152, Visits: 460 |
| | 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 User
       
Group: StrataFrame Users Last Login: 11/12/2008 2:33:56 AM Posts: 152, Visits: 460 |
| | I' ve also found one critical point. CreateDbParameter function of OracleDataSourceItem tries to set nativeDbType. But it assumes object is generated based on ORACLE Table. (See code below.) '-- First set the native db type loReturn.OracleType = CType(QueryInfo.FieldNativeDbTypes(FieldName), OracleType) So, We can not support SQL and ORACLE with the single object. I wonder If Microfour or any other customer implement this case. Can we progress with the customization of the framework or MicroFour can do this for the users of strataframe ? Not : Plus, StrataFrame have to handle the case sensitivity needs on field names and tablenames. |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 11/12/2008 2:33:56 AM Posts: 152, Visits: 460 |
| | Any comment ? No comment, When I need quick responce ! |
| | | | StrataFrame Team Member

Group: StrataFrame Users Last Login: Yesterday @ 9:49:32 AM Posts: 215, Visits: 472 |
| | If you are wanting to do this without re-creating the objects in the BO Mapper using Oracle as the DB source, I would create a shared method someplace that will do a type conversion for you. A good place for this would be your base business object, use the FieldAccessing event (you can enable the event in the BO Mapper), to call your shared method whenever the field is accessed and parse the necessary conversions and such for you. The bottom line is that this is a fairly custom scenario (creating the BO Mapper metadata using one database type and deploying to a seperate data base type) that you will need to account for. It will take some work up front, but it can certainly be done. |
| | | |
|