This question is locked. New answers and comments are not allowed.
Hi All!
First of all, before I started this thread, I looked for similar threads of course:
Our applicaton should run on SQL Server and Oracle backend (but one client uses only one backend at a time).
The physical database models are generated by a 3rd party tool, we tried to avoid the database dependent things: we don't use triggers, sp's, based on the"Mapping a Simple field" documentation we tried to find the similar data types (e.g.: DateTime in SQL and Date in Oracle, bigint in SQL and number(19,0) in Oracle etc.). Both databases contain the same table and column names, PK's, FK's etc.
Our domain model is reverse engineered from the SQL Server database.
The MetaDataContainer is loaded with the metadataSource = AttributesMetadataSource.FromAssembly(...) and metadataContainer = metadataSource.GetModel() methods.
When I try to run the application on Oracle, it throws an exception:
The metadata for field '<column>' of class '<class>' cannot be initialized: Type converter initialization failed. The converter with name 'OracleUdt2StringConverter' does not convert from CLR type 'System.Int64' to SQL type 'bigint'
The reason is obvious: in the Oracle database the integers are stored in number column types, not in bigint.
Based on the previsous forum threads, I think, a solution can be: reverse engineering the Oracle database into a differenct project (into a different namespace maybe?, same or different .rlinq name?), and in the code I have to load this metadatasource/metadatacontainer in the case of Oracle backend?
For me it is enough, if somebody could say a simple 'Yes', if this is the best solution in our case, but I'm open to read any better suggestion!
Regards,
Peter Szintai
First of all, before I started this thread, I looked for similar threads of course:
- Mapping a Simple field
- Adding Oracle to SQL Server based project
- How to support Oracle and SqlServer with only one model
Our applicaton should run on SQL Server and Oracle backend (but one client uses only one backend at a time).
The physical database models are generated by a 3rd party tool, we tried to avoid the database dependent things: we don't use triggers, sp's, based on the"Mapping a Simple field" documentation we tried to find the similar data types (e.g.: DateTime in SQL and Date in Oracle, bigint in SQL and number(19,0) in Oracle etc.). Both databases contain the same table and column names, PK's, FK's etc.
Our domain model is reverse engineered from the SQL Server database.
The MetaDataContainer is loaded with the metadataSource = AttributesMetadataSource.FromAssembly(...) and metadataContainer = metadataSource.GetModel() methods.
When I try to run the application on Oracle, it throws an exception:
The metadata for field '<column>' of class '<class>' cannot be initialized: Type converter initialization failed. The converter with name 'OracleUdt2StringConverter' does not convert from CLR type 'System.Int64' to SQL type 'bigint'
The reason is obvious: in the Oracle database the integers are stored in number column types, not in bigint.
Based on the previsous forum threads, I think, a solution can be: reverse engineering the Oracle database into a differenct project (into a different namespace maybe?, same or different .rlinq name?), and in the code I have to load this metadatasource/metadatacontainer in the case of Oracle backend?
For me it is enough, if somebody could say a simple 'Yes', if this is the best solution in our case, but I'm open to read any better suggestion!
Regards,
Peter Szintai