Search code examples
xamarinshared-projectxamarin-zebblezebblem#

How to import M# IDE generated models to Zebble for Xamarin - Cross platform solution


I started developing a project with M#(4.8.333) IDE and now I have a Domain project which I need to add to Zebble solution Shared Project.

How can I use this M# generated classes in Entities and DAL folder with Zebble mobile projects (UWP ,Android ,..) and still have the ability to change the and modify the project with M# if needed?

Should I manually copy paste the related Entities and DAL classes to this shared project or should I add the existing files directly to shared project, but it gives a few errors.

I knew this was not the correct way, but for sake of learning and understanding the project structure I started resolving the issues by adding the generated files to shared project and actually it creates a copy of them and then compile errors by

  • replacing all MSharp.framework namespaces with Zebble.framework
  • replacing some customize exceptions with simple exceptions
  • replacing SqlDataProvider with SQLiteDataProvider
  • removing Aggregate function in DAL classes
  • changing ValidationResult signature and adding ValidationResult Parameter

    protected override void ValidateProperties(ValidationResult result)

I also know that DAL codes do not needs to be in the shared project except for local cache mechanism for persisting data temporarily but I want to know more about it and use it like the sample Contact DAL classed with SQLiteDataProvider in the template.

What is the best possible way to use M# IDE in Zebble for Xamarin - Cross platform solution?


Solution

  • You should not do that.

    As it's explained in this video you should always keep your client side (mobile) model separate from the server side model: http://zebble.net/docs/web-api-part-3-server-vs-client-domain-model

    There are 4 main reasons which are explained in that video.