I
I
ilyushchenko2018-09-03 23:47:25
.NET
ilyushchenko, 2018-09-03 23:47:25

How to properly move WebApi models to a separate project for reuse in Xamarin?

Good day!
There are 2 solutions with projects: WebAPI on Asp.NET Core 2 and Xamarin Forms.
The architecture of the projects is as follows:
API Solution

  • web API
  • WebApi.Data - Data models are stored here
  • WebApi.Tests
Solution for Xamarin
  • XF
  • XF.Data - Models coming from the API are re-described here

Actually the essence of the question is how to correctly move the models into a separate project and how to refer to them correctly so that their changes would come to both projects.
I would be very grateful if there are examples of such solutions. Thanks in advance.
PS:
Each project has its own solution, so it's not enough just to create a ClassLibrary and refer to it from both projects.
PPS:
After digging around, I found several solutions:
git submodule
As I understand it, in my case it will be possible to create a library project, push models into it and insert it as a submodule into the above solutions. Is this approach correct?
Creating a NuGet package
but how to distribute them without publishing them to NuGet The standard approach is to just include the library manually.
DLL
I do not want to resort to it, because. Now the project is just being created and models are added every day, so I don’t really want to update the library manually every time.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny, 2018-09-09
@ilyushchenko

If it's not a secret, then why not put everything in one solution? As an alternative, you can use one git repository, inside which there will be two solutions. Each of the solutions will reference the same Data project. It's not as elegant, but it will work.

S
Serafim Prozorov, 2018-10-14
@serafimprozorov

The best solution, in my opinion, would be to just create a NuGet package under netstandard.
The NuGet package does not have to be published on NuGet.org, any NuGet repository can be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question