Answered by:
Sync Services + ODP.NET

Question
-
I am working with Rafik's Sync Services for ADO.NET Oracle example (http://www.syncguru.com/projects/SyncServicesDemoOracle.aspx) and trying to use ODP.NET instead of System.Data.OracleClient and consistently receiving:
Type 'Oracle.DataAccess.Types.OpoDatCtx' in Assembly 'Oracle.DataAccess, Version=2.111.6.20, Culture=neutral, PublicKeyToken=89b483f429c47342' is not marked as serializable.
If I recall correctly, one can get around 'not marked as serialable' issues for some types by manually performing a type mapping; however, I'm not quite clear what I would need to map in his scenario. I've done a bit of searching both on the Internet and on the ODP.NET forum but not found anything on this specific type.
Any thoughts?
- Moved by Max Wang_1983 Thursday, April 21, 2011 11:03 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
Monday, June 23, 2008 8:27 PM
Answers
-
Hi,
with the kind help of Alex Keh from Oracle I was able to solve the OpoDatCtx-problem (I'm using the Oracle Xcopy Client 11.1.0.7.20):
1. One has to modify the OaracleParameter-Definitions. The constructors of OracleParameter use Oracle DbTypes by default. If you create a parameter with the empty constructor it is later possible to set the DbType property to a .NET-Type (e.g. DbType.DateTime) which is serializable.
2. The OracleCommand object needs to be modified. Normally, Oracle binds by positon so one needs to set cmd.BindByName to true.
After those (quite small) modification, the sync process runs smootly with the ODP.NET provider.
Regards
Uwe- Proposed as answer by Uwe Reisewitz Wednesday, October 21, 2009 7:37 PM
- Marked as answer by Dong CaoMicrosoft employee, Moderator Tuesday, October 27, 2009 5:46 PM
Wednesday, October 21, 2009 7:37 PM
All replies
-
Nino,
&n******sp;
Unfortunately, the server provider was intended to ******e used and tested against ADO.NET providers Microsoft has implemented and shipped.&n******sp; Is there some reason why System.Data.OracleClient does not meet your needs?&n******sp; If it does not meet your needs, I would recommend that you look into the OpoDatCtx type and convert it into a type that can ******e serialized (i.e. var******inary).&n******sp; I was not a******le to find any references to this type pu******lically so it may ******e an internal type.&n******sp; If this is the case, you might want to contact the company that ships this provider and&n******sp;determine why the&n******sp;ODA provider is attempting to push this type&n******sp;over the wire and if there is a means ******y which to leverage a different type that is suita******le for serialization.&n******sp; You might find that this is a known issue and there is an update to the ODA stack that allows this particular type to ******e serialized.
&n******sp;
Sean Kelley
Program Manager
Microsoft
&n******sp;
&n******sp;
Wednesday, June 25, 2008 9:26 PMModerator -
Nino,
Unfortunately, the server provider was intended to be used and tested against ADO.NET providers Microsoft has implemented and shipped. Is there some reason why System.Data.OracleClient does not meet your needs? If it does not meet your needs, I would recommend that you look into the OpoDatCtx type and convert it into a type that can be serialized (i.e. varbinary). I was not able to find any references to this type publically so it may be an internal type. If this is the case, you might want to contact the company that ships this provider and determine why the ODA provider is attempting to push this type over the wire and if there is a means by which to leverage a different type that is suitable for serialization. You might find that this is a known issue and there is an update to the ODA stack that allows this particular type to be serialized.
Sean Kelley
Program Manager
Microsoft
Wednesday, June 25, 2008 9:27 PMModerator -
Sean,
Thanks for your reply. We were looking at using ODP.NET for some of the additional functionality it supports that System.Data.OracleClient does not; however, we will find a way around that since we need to stay with OracleClient for Sync Services.
I will still query Oracle about the OpoDatCtx type (which, I, too, think is internal), but I don't expect a useful reply from them that will be helpful in our timeline. I was using the latest ODP.NET bits (11.1.0.6.20) when I encountered this error.
-Nino
Monday, June 30, 2008 12:23 PM -
Hi,
with the kind help of Alex Keh from Oracle I was able to solve the OpoDatCtx-problem (I'm using the Oracle Xcopy Client 11.1.0.7.20):
1. One has to modify the OaracleParameter-Definitions. The constructors of OracleParameter use Oracle DbTypes by default. If you create a parameter with the empty constructor it is later possible to set the DbType property to a .NET-Type (e.g. DbType.DateTime) which is serializable.
2. The OracleCommand object needs to be modified. Normally, Oracle binds by positon so one needs to set cmd.BindByName to true.
After those (quite small) modification, the sync process runs smootly with the ODP.NET provider.
Regards
Uwe- Proposed as answer by Uwe Reisewitz Wednesday, October 21, 2009 7:37 PM
- Marked as answer by Dong CaoMicrosoft employee, Moderator Tuesday, October 27, 2009 5:46 PM
Wednesday, October 21, 2009 7:37 PM