how can i create rest api with swagger in xamarin.forms

gazdallah amira 21 Reputation points
2022-03-28T20:49:07.093+00:00

i'm creating a xamarin.forms application so i'm using mvvm pattern and firebase as an SGBD, then i added a new application web ASP.NET core to the project and i implement swagger to build some REST API . but now i'm confused about how to do that:
should i recreate the models folder in the new application ?
how to insert the firebase connection in the new application?
informations: dotnet's version:4.8.04084 , xamarin.forms version: 5.0.0.2337 ,visual studio 2022

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,295 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,276 questions
0 comments No comments
{count} votes

Accepted answer
  1. AgaveJoe 26,136 Reputation points
    2022-03-28T22:18:23.33+00:00

    The first step is to go through a beginning level Web API tutorial so you understand the basics.

    https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-6.0&tabs=visual-studio

    You also want to learn how to use HttpCleint to make calls from the xamarin application to the Web API application.

    https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/web-services/rest

    should i recreate the models folder in the new application ?

    It depends on your application requirements. Usually you'll end up models in both projects. You could also have a separate class library project with shared models. Again go through a few tutorials.

    how to insert the firebase connection in the new application?

    Read the firebase documentation. Firebase has an SDK for .NET.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful