Search code examples
asp.netsql-servermacosxamarinsqlclient

Different ways to connect to SQL Server using Visual Studio on Mac


I am using Visual Studio on Mac (release edition) and I want to connect to a SQL Server.

I am aware that probably the most recommended way would be to create a web service and I understand why.

However, I am so unsuccessful in doing it any other way. Surely a web backend is not the only way?

I can't seem to link to the Entity Framework and the System.Data.SqlClient does not work either.

Am I missing something crucial? I can set it up successfully in VSCode, but not when I want to create a Mac OS app.

In both cases, I am making an app that is "mobile" on my computer.

Setting up SQLite is not a problem, but I am after sharing data between apps - is a web service, other than just being recommended actually the only way to do this within Xamarin?


Solution

  • You'll need to use the 'Core' version of the Entity Framework:

    See: https://learn.microsoft.com/en-us/ef/core/