net-port-initial-thoughts | first-net-port
We now have a beta version for .Net. But it took so long to get out that it is old : it is based on the 1.8 version base code.
We clearly see, it will be over complicated to separately maintain java and .Net version.
We need a way to get both version synchronized. One way, that we are already exploring to use a more efficient converting tool to get java version converted to C# version.
So the idea is to get (1) simple (logic) classes automatically converted and write (2) the core classes in C#.
1) Simple Java Logic seems to be converted seemlessly to C#
2) Core Classes : classes that deal with direct/internal API like IO API, System API,…. We create Wrapper classes in both Java and C# so that the whole NeoDatis API uses theses wrappers and each versions (Java & C#) has its own implementation of the wrappers.
Here a simple example:
In many places we need to get the current time of the system:
In Java, we use System.currentTimeMillis() and in C#, we use DateTime.Now.Ticks. In order to simplify the conversion, we created a Wrapper class OdbTime which has a method getCurrentTimeInMs/GetCurrentTimeInMs. So the NeoDatis ODB API uses the wrapper class in both Java and C#.
And the specific implementation has been implemented in Java and C# as followed:
Java Code
package org.neodatis.tool.wrappers; /** * @author olivier * */ public class OdbTime { public static long getCurrentTimeInMs(){ return System.currentTimeMillis(); } }
C# code
namespace NeoDatis.Tool.Wrappers{ /** * @author olivier * */ public class OdbTime { public static long GetCurrentTimeInMs(){ return DateTime.Now.Ticks; } } }
This way, the conversion process is simpler and all specific NeoDats ODB API can be manually written with the right/better native API.
The Java to C# Conversion project has two main directories:
src-csharp-native : contains all the C# manually written code
src-csharp-generated : contains all the java to c# converted code
Then both directories (native and generated) are put together to build the whole project.







