Parse "0" / "1" as bool in (.NET 4.0 C #) Sync Framework 4.0 CTP

Is it possible to have some type of converter that allows the Sync Framework to process the string "0" / "1" as boolean values ​​for false / true. According to bool.parse, the documentation is not supported by default, so is there a way around this?

More in detail, if someone can suggest a different approach to this problem: I have a custom implementation of the Sync Framework client for android, and since it uses the SQLite database, I will not be able to force a strict data type into the table field. I could come up with an agreement to indicate a logical field with, say, the prefix "Yes", but that would be nasty. Another thing is that booleans in SQLite are considered as numeric types, so inserting / updating boolean false / true into a SQLite database will automatically convert them to 0/1, and I do not want to introduce any TRUE / FALSE = 1/0 side conversion android

Any thoughts are welcome.

[UPDATE] More: The server part consists of some services that use Microsoft Sync Framework 4.0 CTP. There are not many settings other than creating an area, etc. The client side creates a set of changes and transfers it to the server using the JSON format. The set of changes comes from the SQLite database (and SQLite has no logical representation of its own, except for the numeric 0/1), so when reading the database there is no indication that the nearest data is of a logical type. The field value is serialized into a JSON object as a string with a numeric value ("0" or "1"), and thus the server side does not work, trying to parse it to bool.

Btw , . , Sync Framework "" . - tho '.

+5
4

, . Android SQLite .

.

0
+2

- TRUE/FALSE = 1/0 android

You seem to have to, since there is no logical type in SQLite.

boolean active = cursor.getInt(column_idx)==1;
0
source

for the Sync Framework bits, did you try to implement Interceptors to catch changes and perform the conversion? see How to: Extend the business logic on the server using interceptors

0
source

All Articles