I’m trying to implement a client-server solution with MonoTouch + Mono for Android.
For the server side, I’m using an ADO.NET entity model. AFAIK, this is not a part of the above frameworks, but my question is:
Can I reference a (common) ADO.NET/EF4-based data layer project in the client only for the sake of partially reusing the entities on the client side? Alternatively, is there a different solution for this architectural issue?
EDIT: Forgot to say, for the client side, I’m thinking about POCO entities, automatically generated from the POCO template.
A good way to do such a thing is by going for the Code-first approach in ADO.NET entity framework. After you have created the entities on the server and built a DataContext implementation for them, follow these steps to add entities to your Mono for Android project (If you’re using Visual Studio that is).
Now when you edit the files in the server project or the client, they will stay in sync.
Keep in mind that the set of attributes and API’s you can use from the entities is limited. It may take a bit of fiddeling to get things right.
Tip: Use partial classes for adding environment specific behavior and data. Add a second .cs file for each entity class and add any members that you don’t want on the client to that file. The same works for client features you only want in your app, but not on the server.
All of the above also works when you work on a mac with MonoDevelop. That application also supports linking items that are on a different location from the .csproj file location.