简体   繁体   中英

How to use Entity Framework Core with SQL Server in Xamarin Forms?

I'm trying to use Entity Framework Core with SQL Server (not SQLite) in a Xamarin forms app but I just can't figure it out! All tutorials explain how to use EF Core with sqlite! Are there any clear documentation or tutorials?

About connect to a Remote DataBase in Xamarin.Forms, I find one article that you can take a look:

https://xamarinhelp.com/connecting-remote-database-xamarin-forms/

You may be wondering why you couldn't just connect directly to a database from your mobile app? The main reasons are:

Security

You don't want your mobile client apps to have a database connection string with a username and password in it. It opens your database up to anyone. You can create a user with read only permissions and only allow access to certain tables, but they could still see all data in these tables. On an API, you can implement additional security checks and have authentication based on OAuth or an existing user management system.

Performance

Database connections weren't designed to go over high latency connections. It is likely your database connection would keep dropping, forcing you to reconnect every time.

Control

With an API you can control the flow of data to and from your database. You can implement rate limiting, and monitoring of all of your requests. If you need to change business logic, or even what database or resources are used via each API request, you can do this on the server, without having to redeploy a mobile app.

Resources

With an API, you reduce the need for server resources. While you may have to setup another server to handle an API, the REST API is designed to be stateless and efficient. Scaling to many users in the future is easier with an API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM