cancel
Showing results for 
Search instead for 
Did you mean: 

.NET web api accessing SQL Anywhere

dhkom
Participant
0 Kudos
1,882

Has anyone written a ASP.NET Core Web API targeting SQL Anywhere? I suspect this is problematic because the ConfigureServices method in the Startup class needs to set up a DbContext, which is an Entity Framework Core object, and SQL Anywhere does not have an Entity Framework Core provider. I don't see a generic ODBC EF Core provider.

Does anyone have success using System.Data.Odbc instead of Entity Framework Core in an ASP.NET Core Web API?

I would really enjoy seeing a "Startup.cs" file from such a .NET project.

Any guidance on how to proceed would be appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

For .Net Core you can not use Entity Framework at all with SQL Anywhere. You can only use a plain ODBC connection.

dhkom
Participant
0 Kudos

Thanks. I'd really like to see an example of what you would encode for "services.AddDataContext..." when using a plain ODBC connection.

0 Kudos

there is none. you can't do that at all. That is an Entity Framework concept.

dhkom
Participant
0 Kudos

Thanks, again. Can you suggest an alternative with "plain ODBC"? Is it at all possible to create a ASP.NET Core Web API that uses "plain ODBC" to work with a SQL Anywhere database? I know we can do this using Appeon frameworks, and we are doing so, but I'm interested to know whether there is a "pure Microsoft" approach.

0 Kudos

the same way you would have done anything with SQL Anywhere and C# before Entity Framework came along.

dhkom
Participant
0 Kudos

Very good. Thanks. I'm new to this technology, so I haven't done this before EF came along. However I'll cross that bridge if I get to it.